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.

↑ Back to top


position()

Returns the Animation’s position relative to its Entity.

Returns

Vec3 {x, y} relative coordinates of the Animation.

↑ Back to top


rotation()

Returns the rotation of the Animation. in degrees.

Returns

number the rotation of the Animation, in degrees.

↑ Back to top


scale()

Returns the scale of the Animation.

Returns

Vec2 {x, y} scale of the Animation.

↑ Back to top


setFrame(value)

Sets the Animation to a specific frame.

Parameters

number value – the frame the Animation will be set to.

↑ Back to top


setOpacity(value)

Sets the opacity of the Animation.

Parameters

number value – new opacity value, range: 0-255

↑ Back to top


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

↑ Back to top


setRotation(value)

Sets the rotation of the Animation, in degrees.

Parameters

number value – new rotation of the Animation, in degrees

↑ Back to top


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

↑ Back to top


setVisible(value)

Sets the visibility of the Animation.

Parameters

boolean value – true for visible, false for not visible.

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?