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.
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.
Constructor
- Core()
- Creates a new Core object.
Properties
- Core.prototype.back
- 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
- 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
- The front layer. Anything to be drawn in front of the props, such as the palm, will be placed on this layer.
- Core.prototype.middle
- The middle layer. It is used for drawing props, but rarely manipulated from outside the Core object.
- Core.prototype.svg
- 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 palm graphic elements. By default, the front layer is used.
- Core.prototype.setProps()
- Sets the graphic elements of the props list. The middle layer is used.
- Core.prototype.setScale()
- Sets the scale applied to the <svg> tag.
- Core.prototype.setStyle()
- Sets visual styles of graphic elements. By default, it applies to the front and back layers.