-
Notifications
You must be signed in to change notification settings - Fork 2
Animation
The Animation class is used to handle the animation of single values with multiple keyframes and pauses.
Animation:onFinish()
Called when the whole animation finishes.
Animation:onFrameFinished( number frame )
Called when an individual frame (including the last one, and pauses) finishes.
Animation.rounded - boolean
Defines whether the result of the animation should be rounded, for use with things like positions, which must be integers.
This method is chainable.
Animation:addKeyFrame( number initial, number final, number time = 0.5, optional function easing )
Adds a frame to the animation. The animation's value will go between initial and final using the easing provided until it has completed, at which point it will move onto the next frame.
Animation:addKeyFrame( number initial, number final, number duration = 0.5, string easing )
Same as above, but takes "transition", "entrance" and "exit" as easing.
This method is chainable.
Animation:addPause( number duration )
Adds a pause to the animation. duration seconds will pass before advancing to the next frame after the pause.
This method is chainable.
Animation:setRounded()
Sets the rounded variable of the animation to true
Animation:update( number dt )
Updates the animation, re-calculating its value based on its frames and pauses. dt is the time between now and when it was last updated.
boolean finished = Animation:finished()
Returns whether the animation has finished.
- Exception
- DynamicValueException
- ExpressionException
- IncorrectConstructorException
- IncorrectParameterException
- ParserException
- ResourceLoadException
- ThreadRuntimeException