Animator
The Animator object achieves animation by having Core continuously draw still images. The graphic elements of the still image are preset in Core, and the display positions are shifted for each index number. The index number changes every 40 milliseconds, resulting in an animation of 25 frames per second.
index number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
---|---|---|---|---|---|---|---|---|---|---|---|
prop A | init | ai0 | ai1 | ||||||||
loop | al0 | al1 | al2 | al3 | al4 | al5 | (al0) | (al1) | |||
prop B | init | bi0 | bi1 | bi2 | |||||||
loop | bl0 | bl1 | bl2 | bl3 | bl4 | bl5 | bl6 | ||||
prop C | init | ||||||||||
loop | cl0 | cl1 | cl2 | cl3 | (cl0) | (cl1) | (cl2) | (cl3) | (cl0) | (cl1) |
The ai0, bl1, etc. in the table are objects with x and y properties as the coordinates to display the props.
Prop A has two initial actions, ai0 and ai1, and six loop actions, al0 through al5. Initially the "init" coordinates are used in order, and when the end of the "init" is reached, the "loop" coordinates are used in order. When the end of the "loop" is reached, the iteration returns to the first coordinate al0 and is used again in order.
Prop B has 3 "init" coordinates and 7 (or more) "loop" coordinates. In this way, there is no problem even if the number of "init" and "loop" are different for each prop.
Prop C has 0 "init" coordinates and 4 "loop" coordinates. If there are no "init" coordinates, the "loop" coordinates are used from the beginning. If there are no "loop" coordinates, subsequent index numbers do not change the display.
Constructor
- Animator()
- Creates a new Animator object.
Properties
- Animator.prototype.arms
- An array of arms. One arm is an array of joint state lists, set arms as an array. The state list is an object like the following (same as the prop state list), and set the objects as an array for the number of joints.
-
{ "init": [ pi0, pi1, pi2, ... ], "loop": [ pl0, pl1, pl2, ... ], }
- You can set the arms property of the return value of BasicCreator.prototype.calculateOrbits() as it is.
- Animator.prototype.core
- An instance of a Core object that displays the still image. Set the graphic elements used for animation directly to this property.
- Animator.prototype.props
- An array of prop state lists. The state list is an object like the following (same as the joint state list), and set the objects as an array for the number of props.
-
{ "init": [ pi0, pi1, pi2, ... ], "loop": [ pl0, pl1, pl2, ... ], }
- You can set the props property of the return value of BasicCreator.prototype.calculateOrbits() as it is.
Methods
- Animator.prototype.getIndex()
- Returns the animation index number.
- Animator.prototype.getStatus()
- Returns the execution status of the animation.
- Animator.prototype.setIndex()
- Sets the animation index number.
- Animator.prototype.start()
- Starts the animation.
- Animator.prototype.stop()
- Stops the animation.