¶
luxe API (2025.1.2)¶
luxe: system/anim.modifier module¶
Anim¶
import "luxe: system/anim.modifier" for Anim
Animis an animation player attached to an entity.It plays animations from animation assets or ones created from code. Animations can target the entity
Animis attached to, but can target any entity. For example, a level cutscene could be played back from one entity, but it drives several other entities. From assets like scenes and prototypes,Animprovides an autoplay list, for playing when loaded.You can play multiple animations at the same time, for example, the player might have a walk animation playing and you play a glowing animation on top.
Animsupports curve, linear and discrete driven animations and is expanded on by World Systems that provide animation tracks.
- create(entity:
Entity) - destroy(entity:
Entity) - has(entity:
Entity) - valid(entity:
Entity, anim:Anim) - get_source_id(entity:
Entity, anim:Anim) - get_state(entity:
Entity, anim:Anim) - get_active_anims(entity:
Entity) - play(entity:
Entity, anim_lx:ID, time_offset:Num) - blend(entity:
Entity, anim_lx:ID, blend_time:Num, time_offset:Num) - play(entity:
Entity, anim_lx:ID) - blend(entity:
Entity, anim_lx:ID, blend_time:Num) - play_only(entity:
Entity, anim_lx:ID, time_offset:Num) - play_only(entity:
Entity, anim_lx:ID) - stop(entity:
Entity, anim:Anim, reset:Bool) - stop(entity:
Entity, anim:Anim) - stop_all(entity:
Entity, reset:Bool) - stop_all(entity:
Entity) - create_track(entity:
Entity, anim:Anim, track_id:Any, track_type:Any) - has_track(entity:
Entity, anim:Anim, track_id:Any) - track_set_range(entity:
Entity, anim:Anim, track_id:Any, min:Any, max:Any) - track_get_range(entity:
Entity, anim:Anim, track_id:Any) - track_set(entity:
Entity, anim:Anim, track_id:Any, property:Any, value:Any) - track_set_channel(entity:
Entity, anim:Anim, track_id:Any, channel_id:Any, channel_idx:Any, interp:Any, keys:Any) - set_play_count(entity:
Entity, anim:Anim, play_count:Num) - set_rate(entity:
Entity, anim:Anim, rate:Num) - set_start(entity:
Entity, anim:Anim, start:Num) - set_end(entity:
Entity, anim:Anim, end:Num) - set_interval_time(entity:
Entity, anim:Anim, time:Num) - get_play_count(entity:
Entity, anim:Anim) - get_rate(entity:
Entity, anim:Anim) - get_duration(entity:
Entity, anim:Anim) - get_start(entity:
Entity, anim:Anim) - get_end(entity:
Entity, anim:Anim) - get_interval_time(entity:
Entity, anim:Anim) - on_event(entity:
Entity, anim:Anim, fn:Fn)
Entity)
¶unknown
Attach an
Animmodifier toentity.var entity = Entity.create(world) Anim.create(entity)
Entity)
¶None
Detach and destroy the
Animattached toentity.Anim.destroy(entity)
Entity)
¶Bool
Returns whether
entityhas anAnimmodifier attached.if(Anim.has(entity)) { Log.print("found anim") }
Entity, anim: Anim)
¶Bool
Returns whether the
Animinstance is valid for theAnimattached toentity.var anim = Anim.play(entity, "player/idle") if(!Anim.valid(entity, anim)) { Log.print("oh no!") }
Entity, anim: Anim)
¶ID
Returns the
IDof the animation asset that theAniminstance was played from, if known, by asking theAnimattached toentity. Returnsnullif not.var anim = Anim.play(entity, "player/idle") var source_id = Anim.get_source_id(entity, anim) Log.print(Strings.get(source_id)) //expect: "player/idle"
Entity, anim: Anim)
¶AnimState
Return the animation state of the
Animinstance, by asking theAnimattached toentity.var anim = Anim.play(entity, "player/idle") var state = Anim.get_state(entity, anim) if(state == AnimState.playing) { Anim.stop(entity, anim) }
Entity)
¶List
Returns a list of
Animinstances that are active on theAnimattached toentity.var active = Anim.get_active_anims(entity) for(anim in active) { var state = Anim.get_state(entity, anim) Log.print(AnimState.name(state)); }
Entity, anim_lx: ID, time_offset: Num)
¶Anim
Play the animation asset
anim_lxon the Anim attached toentity. Thetime_offsetis a time in seconds to begin playback from. For example, you might pause an animation and hold onto the animation time when it was paused. Then when resuming, you can play from the new time. Returns the newly startedAniminstance.var anim = Anim.play(entity, "player/idle", 0.5)
Entity, anim_lx: ID, blend_time: Num, time_offset: Num)
¶Anim
Play the animation asset
anim_lxon theAnimattached toentitywith a blend fade time. Thetime_offsetis a time in seconds to begin playback from. Theblend_timeis handled by some tracks, not all. Returns the newly startedAniminstance.//fade in the animation over 0.6 seconds var anim = Anim.blend(entity, "player/idle", 0.6)
Entity, anim_lx: ID)
¶Anim
Play the animation asset
anim_lxon theAnimattached toentity. Plays from the beginning. Returns the newly startedAniminstance.var anim = Anim.play(entity, "player/idle")
Entity, anim_lx: ID, blend_time: Num)
¶Anim
Play the animation asset
anim_lxon theAnimattached toentitywith a blend fade time. Plays from the beginning. Blend time is handled by some tracks, not all. Returns the newly startedAniminstance.//fade in the animation over 0.6 seconds var anim = Anim.blend(entity, "player/idle", 0.6)
Entity, anim_lx: ID, time_offset: Num)
¶Anim
Play the animation asset
anim_lxon theAnimattached toentity, stopping all other active anims, and only playing this one. Thetime_offsetis a time in seconds to begin playback from. Returns the newly startedAniminstance.var anim = Anim.play_only(entity, "player/idle", 0.5)
Entity, anim_lx: ID)
¶Anim
Play the animation asset
anim_lxon theAnimattached toentity, stopping all other active anims, and only playing this one. Returns the newly startedAniminstance.var anim = Anim.play_only(entity, "player/idle")
Entity, anim: Anim, reset: Bool)
¶None
Stop the
Animinstance if playing on theAnimattached toentity.If
resetistrue, the state of anything that was being animated by thisAniminstance, will be reset to what it was before it was played. For example, if your animation is changing the transform position, it will revert back to the position at the time the animation was played.var anim = Anim.play(entity, "player/idle") Anim.stop(entity, anim, true)
Entity, anim: Anim)
¶None
Stop the
Animinstance if playing on theAnimattached toentity. State is not reset (seeAnim.stop(entity, anim, reset)).var anim = Anim.play(entity, "player/idle") Anim.stop(entity, anim)
Entity, reset: Bool)
¶None
Stop all active
Animinstances playing on theAnimattached toentity. Ifresetistrue, state will be reset to the state before the animation started (seeAnim.stop(entity, anim, reset)).var anim = Anim.play(entity, "player/idle") Anim.stop_all(entity, true)
Entity)
¶None
Stop all active
Animinstances playing on theAnimattached toentity. State is not reset (seeAnim.stop(entity, anim, reset)).var anim = Anim.play(entity, "player/idle") Anim.stop_all(entity)
Entity, anim: Anim, track_id: Any, track_type: Any)
¶unknown
no docs found
Entity, anim: Anim, track_id: Any)
¶unknown
no docs found
Entity, anim: Anim, track_id: Any, min: Any, max: Any)
¶unknown
no docs found
Entity, anim: Anim, track_id: Any)
¶unknown
no docs found
Entity, anim: Anim, track_id: Any, property: Any, value: Any)
¶unknown
no docs found
Entity, anim: Anim, track_id: Any, channel_id: Any, channel_idx: Any, interp: Any, keys: Any)
¶unknown
no docs found
Entity, anim: Anim, play_count: Num)
¶None
Set the amount of times to play the
Animinstance on theAnimattached toentity. Theplay_countvalue can be0, which will loop forever.//play 3 times and then end var anim = Anim.play(entity, "player/idle") Anim.set_play_count(entity, anim, 3)
Entity, anim: Anim, rate: Num)
¶None
Set the playback rate of the
Animinstance on theAnimattached toentity. The rate of1is the default speed.0.5is half speed, and2is twice as fast.var anim = Anim.play(entity, "player/idle") Anim.set_rate(entity, anim, 0.5)
Entity, anim: Anim, start: Num)
¶None
Set the start marker of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_start(entity, anim, 0)
Entity, anim: Anim, end: Num)
¶None
Set the end marker of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_end(entity, anim, 1)
Entity, anim: Anim, time: Num)
¶None
Set the current playback time of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_interval_time(entity, anim, 0.5)
Entity, anim: Anim)
¶Num
Return the play count of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim)
¶Num
Return the rate of playback of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim)
¶Num
Return the duration of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim)
¶Num
Return the start marker of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim)
¶Num
Return the end marker of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim)
¶Num
Return the current playback time of the
Animinstance on theAnimattached to entity. note This API is WIP.var play_count = Anim.get_play_count(entity, anim)
Entity, anim: Anim, fn: Fn)
¶None
no docs found
AnimEvent¶
import "luxe: system/anim.modifier" for AnimEvent
no docs found
unknown
An event fired when an animation started playing.
unknown
An event fired when an animation is updated, but only if the track is set to emit the event.
unknown
An event fired when an animation is stopped or done playing.
AnimInterpolation¶
import "luxe: system/anim.modifier" for AnimInterpolation
An enum for types of interpolation in animation tracks.
unknown
An invalid or unknown value.
if(value == AnimInterpolation.unknown) { Log.print("unknown interpolation type!") }
unknown
The animation values between keys will be interpolated according to the curve defined by the keys themselves.
if(value == AnimInterpolation.curve) { Log.print("curve") }
unknown
The animation values between keys will be interpolated linearly. For example if your keys were
{ time=0 value=0 }and{ time=1 value=4 }, at the time of0.5the value would be2, half of the next key.if(value == AnimInterpolation.linear) { Log.print("linear") }
unknown
The animation values between keys would not be interpolated, they would jump from one value to the next. For example if your keys were
{ time=0 value=0 }and{ time=1 value=3 }, with discrete the value at time0.5is still0(instead of1.5with linear). It will only change to3when the next key is reached.if(value == AnimInterpolation.discrete) { Log.print("discrete") }
AnimInterpolation)
¶String
Convert an
AnimInterpolationvalue to a string.var type = AnimInterpolation.linear var name = AnimInterpolation.name(type) Log.print("type is %(name)") //expect: "linear"
String)
¶AnimInterpolation
Get the
AnimInterpolationvalue to a name.var type = AnimInterpolation.from_string("discrete") Log.print("discrete is value %(type)") //expect: "3", the internal value
AnimInterval¶
import "luxe: system/anim.modifier" for AnimInterval
no docs found
- create(world:
Any, duration:Any, rate:Any) - create(world:
Any, duration:Any) - time(world:
Any, anim:Any) - set_time(world:
Any, anim:Any, time:Any) - set_now(world:
Any, anim:Any, offset:Any) - set_now(world:
Any, anim:Any) - set_play_count(world:
Any, anim:Any, count:Any) - set_clock(world:
Any, anim:Any, clock:Any) - set_rate(world:
Any, anim:Any, rate:Any) - set_duration(world:
Any, anim:Any, duration:Any) - set_start(world:
Any, anim:Any, start:Any) - set_end(world:
Any, anim:Any, end:Any) - get_now(world:
Any, anim:Any) - get_play_count(world:
Any, anim:Any) - get_clock(world:
Any, anim:Any) - get_rate(world:
Any, anim:Any) - get_duration(world:
Any, anim:Any) - get_start(world:
Any, anim:Any) - get_end(world:
Any, anim:Any)
Any, duration: Any, rate: Any)
¶unknown
no docs found
Any, duration: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any, time: Any)
¶unknown
no docs found
Any, anim: Any, offset: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any, count: Any)
¶unknown
no docs found
Any, anim: Any, clock: Any)
¶unknown
no docs found
Any, anim: Any, rate: Any)
¶unknown
no docs found
Any, anim: Any, duration: Any)
¶unknown
no docs found
Any, anim: Any, start: Any)
¶unknown
no docs found
Any, anim: Any, end: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
Any, anim: Any)
¶unknown
no docs found
AnimState¶
import "luxe: system/anim.modifier" for AnimState
An enum for the state of an
Animinstance.
Num
The animation is inactive. :todo: This may be obsolete.
var state = Anim.get_state(entity, anim) if(state == AnimState.inactive) { Log.print("anim is inactive") }
Num
The animation is active and is playing.
var state = Anim.get_state(entity, anim) if(state == AnimState.playing) { Log.print("anim is playing") }
Num
The animation is ending, and will be marked complete next update.
var state = Anim.get_state(entity, anim) if(state == AnimState.ending) { Log.print("anim is ending") }
Num
The animation has ended and is complete.
var state = Anim.get_state(entity, anim) if(state == AnimState.complete) { Log.print("anim is complete") }
Num)
¶String
Convert an
AnimStatevalue to a string.var type = AnimState.ending var name = AnimState.name(type) Log.print("type is %(name)") //expect: "ending"
String)
¶Num
Convert a string to an enum value.
var state = AnimState.from_string("ending") var same = state == AnimState.ending //true
Data¶
import "luxe: system/anim.modifier" for Data
no docs found
var play : List = []
System¶
import "luxe: system/anim.modifier" for System
no docs found
- new(world:
World)
World)
¶System
no docs found