Animation
This kind of Animation can be created from an Animation script attribute. It’s useful because you can instantiate many copies of the same animation attribute using code. An Animation is two-dimensional. Here’s an example of creating an Animation from an attribute.
let attribute = this.attribute('Flame'); let anim = new Animation(attribute, this);
Function | Description |
---|---|
play() |
Starts playing the animation from its beginning. |
position() |
Returns the Animation’s position relative to its Entity. |
rotation() |
Returns the rotation of the Animation. in degrees. |
scale() |
Returns the scale of the Animation. |
setFrame(value) |
Sets the Animation to a specific frame. |
setOpacity(value) |
Sets the opacity of the Animation. |
setPosition(x, y, z) |
Sets the position of the Animation. |
setRotation(value) |
Sets the rotation of the Animation, in degrees. |
setScale(x, y, z) |
Sets the scale of the Animation. |
setVisible(value) |
Sets the visibility of the Animation. |
play()
Starts playing the animation from its beginning.
position()
Returns the Animation’s position relative to its Entity.
Returns
Vec3 {x, y} relative coordinates of the Animation.
rotation()
Returns the rotation of the Animation. in degrees.
Returns
number the rotation of the Animation, in degrees.
scale()
Returns the scale of the Animation.
Returns
Vec2 {x, y} scale of the Animation.
setFrame(value)
Sets the Animation to a specific frame.
Parameters
number value – the frame the Animation will be set to.
setOpacity(value)
Sets the opacity of the Animation.
Parameters
number value – new opacity value, range: 0-255
setPosition(x, y, z)
Sets the position of the Animation.
Parameters
number x – new x-axis position of the Animation
number y – new y-axis position of the Animation
number z – (optional) z-axis position of the Animation
setRotation(value)
Sets the rotation of the Animation, in degrees.
Parameters
number value – new rotation of the Animation, in degrees
setScale(x, y, z)
Sets the scale of the Animation.
Parameters
number x – x-axis scale of the Animation
number y – y-axis scale of the Animation
number z – (optional) z-axis scale of the Animation
setVisible(value)
Sets the visibility of the Animation.
Parameters
boolean value – true for visible, false for not visible.