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('

AnimationInstance

This is the AnimationInstance class. It represents a single animation instance

Functions

MethodReturnsDescription
AnimationInstance.newAnimationInstanceCreates a new animation instance
AnimationInstance:startAnimationInstanceStarts the animation
AnimationInstance:updatebooleanUpdates the animation
AnimationInstance:complete-Called when the animation is completed

AnimationInstance.new(element, animType, args, duration, easing)

Creates a new AnimationInstance

Parameters

Returns

AnimationInstance:start()

Starts the animation

Returns

AnimationInstance:update(elapsed)

Updates the animation

Parameters

Returns

AnimationInstance:complete()

Gets called when the animation is completed

Animation

This is the animation plugin. It provides a animation system for visual elementswith support for sequences, easing functions, and multiple animation types.

Functions

MethodReturnsDescription
Animation.registerAnimation-Registers a custom animation type
Animation.registerEasing-Adds a custom easing function
Animation.newAnimationCreates a new animation
Animation:sequenceAnimationCreates a new sequence
Animation:onStart-Registers a callback for the start event
Animation:onUpdateAnimationRegisters a callback for the update event
Animation:onCompleteAnimationRegisters a callback for the complete event
Animation:addAnimation-Adds a new animation to the sequence
Animation:startAnimationStarts the animation
Animation:event-The event handler for the animation
Animation:stop-Stops the animation

Animation.registerAnimation(name, handlers)

Registers a new animation type

Parameters

Usage

lua
Animation.registerAnimation("fade", {start=function(anim) end, update=function(anim,progress) end})

Animation.registerEasing(name, func)

Registers a new easing function

Parameters

Animation.new(element)

Creates a new Animation

Parameters

Returns

Animation:sequence()

Creates a new sequence

Returns

Animation:onStart(callback)

Registers a callback for the start event

Parameters

Animation:onUpdate(callback)

Registers a callback for the update event

Parameters

Returns

Animation:onComplete(callback)

Registers a callback for the complete event

Parameters

Returns

Animation:addAnimation(type, args, duration, easing)

Adds a new animation to the sequence

Parameters

Animation:start()

Starts the animation

Returns

Animation:event(event, timerId)

The event handler for the animation (listens to timer events)

Parameters

Animation:stop()

Stops the animation immediately: cancels timers, completes running anim instances and clears the element property

VisualElement

Adds additional methods for VisualElement when adding animation plugin

Functions

MethodReturnsDescription
VisualElement.stopAnimation-Convenience to stop animations from the element
VisualElement:animateAnimationCreates a new animation

VisualElement.stopAnimation()

Convenience to stop animations from the element

VisualElement:animate()

Creates a new Animation Object

Returns

',86)]))}const p=e(o,[["render",r]]);export{u as __pageData,p as default};