import{_ as e,a as t,b as n,ag as i}from"./chunks/framework.BcrMLAmg.js";const u=JSON.parse('{"title":"AnimationInstance","description":"","frontmatter":{},"headers":[],"relativePath":"references/plugins/animation.md","filePath":"references/plugins/animation.md","lastUpdated":1757844696000}'),o={name:"references/plugins/animation.md"};function r(s,a,l,d,c,m){return n(),t("div",null,a[0]||(a[0]=[i('
This is the AnimationInstance class. It represents a single animation instance
| Method | Returns | Description |
|---|---|---|
| AnimationInstance.new | AnimationInstance | Creates a new animation instance |
| AnimationInstance:start | AnimationInstance | Starts the animation |
| AnimationInstance:update | boolean | Updates the animation |
| AnimationInstance:complete | - | Called when the animation is completed |
Creates a new AnimationInstance
element VisualElement The element to animateanimType string The type of animationargs table The animation argumentsduration number Duration in secondseasing string The easing function nameAnimationInstance The new animation instanceStarts the animation
AnimationInstance self The animation instanceUpdates the animation
elapsed number The elapsed time in secondsboolean Whether the animation is finishedGets called when the animation is completed
This is the animation plugin. It provides a animation system for visual elementswith support for sequences, easing functions, and multiple animation types.
| Method | Returns | Description |
|---|---|---|
| Animation.registerAnimation | - | Registers a custom animation type |
| Animation.registerEasing | - | Adds a custom easing function |
| Animation.new | Animation | Creates a new animation |
| Animation:sequence | Animation | Creates a new sequence |
| Animation:onStart | - | Registers a callback for the start event |
| Animation:onUpdate | Animation | Registers a callback for the update event |
| Animation:onComplete | Animation | Registers a callback for the complete event |
| Animation:addAnimation | - | Adds a new animation to the sequence |
| Animation:start | Animation | Starts the animation |
| Animation:event | - | The event handler for the animation |
| Animation:stop | - | Stops the animation |
Registers a new animation type
name string The name of the animationhandlers table Table containing start, update and complete handlersAnimation.registerAnimation("fade", {start=function(anim) end, update=function(anim,progress) end})Registers a new easing function
name string The name of the easing functionfunc function The easing function (takes progress 0-1, returns modified progress)Creates a new Animation
element VisualElement The element to animateAnimation The new animationCreates a new sequence
Animation self The animation instanceRegisters a callback for the start event
callback function The callback function to registerRegisters a callback for the update event
callback function The callback function to registerAnimation self The animation instanceRegisters a callback for the complete event
callback function The callback function to registerAnimation self The animation instanceAdds a new animation to the sequence
type string The type of animationargs table The animation argumentsduration number The duration in secondseasing string The easing function nameStarts the animation
Animation self The animation instanceThe event handler for the animation (listens to timer events)
event string The event typetimerId number The timer IDStops the animation immediately: cancels timers, completes running anim instances and clears the element property
Adds additional methods for VisualElement when adding animation plugin
| Method | Returns | Description |
|---|---|---|
| VisualElement.stopAnimation | - | Convenience to stop animations from the element |
| VisualElement:animate | Animation | Creates a new animation |
Convenience to stop animations from the element
Creates a new Animation Object
Animation animation The new animation