Core

The Core object renders a still image in an HTML <svg> tag. It has graphic elements of props and arms inside and draws them at the specified coordinates.

(-150, -255) (0, 0) (150, 45)

The default drawing area is 300×300. The origin (0, 0) is where the centerline of the body intersects the centerline of the prop's home position. The x-coordinate is positive to the right, but the y-coordinate is positive down, unlike the usual Cartesian coordinates.

There are 3 drawing layers. Props are drawn on the middle layer, and body parts are drawn on the front or back layer. By default, the head and arms are drawn on the back, while the hands are drawn on the front.

Constructor

Core()
Creates a new Core object.

Properties

Core.prototype.back (read-only)
The back layer. Anything to be drawn behind the props, such as the head or arms, will be placed on this layer.
Core.prototype.defs (read-only)
An object representing a <defs> tag. If it is in Core.prototype.svg it will be used, otherwise it will be created.
Core.prototype.front (read-only)
The front layer. Anything to be drawn in front of the props, such as the hands, will be placed on this layer.
Core.prototype.middle (read-only)
The middle layer. It is used for drawing props, but rarely manipulated from outside the Core object.
Core.prototype.props
An array of graphic elements of the props list. The middle layer is used.
Any graphic elements that can be set in the <svg> tag will be added to Core.prototype.defs in the specified order. However, at the moment no drawing has been done yet, and for that you need to call drawProps() method.
Core.prototype.scale
A positive real value representing the scale. If the scale is greater than 1, the drawing area will be larger and the person and props will be smaller. If the scale is less than 1, the opposite applies. You can set the value of CalmGenerator.prototype.scale.
Core.prototype.svg (read-only)
An object representing a <svg> tag.

Methods

Core.prototype.drawArms()
Draws all arms given a list of coordinates.
Core.prototype.drawProps()
Draws all props given a list of coordinates.
Core.prototype.setArms()
Sets arm graphic elements. By default, the back layer is used.
Core.prototype.setBody()
Sets immovable graphic elements such as the head and body. By default, the back layer is used.
Core.prototype.setHands()
Sets hand graphic elements. By default, the front layer is used.
Core.prototype.setStyle()
Sets visual styles of graphic elements. By default, it applies to the front and back layers.