luxe: system/anim.modifier
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.
Anim.create(.)
Section titled “Anim.create(.)”Anim.create(entity : Entity) : unknownAttach an
Animmodifier toentity.var entity = Entity.create(world)Anim.create(entity)
Anim.destroy(.)
Section titled “Anim.destroy(.)”Anim.destroy(entity : Entity) : NoneDetach and destroy the
Animattached toentity.Anim.destroy(entity)
Anim.has(.)
Section titled “Anim.has(.)”Anim.has(entity : Entity) : BoolReturns whether
entityhas anAnimmodifier attached.if(Anim.has(entity)) {Log.print("found anim")}
Anim.valid(..)
Section titled “Anim.valid(..)”Anim.valid(entity : Entity, anim : Anim) : BoolReturns whether the
Animinstance is valid for theAnimattached toentity.var anim = Anim.play(entity, "player/idle")if(!Anim.valid(entity, anim)) {Log.print("oh no!")}
Anim.get_source_id(..)
Section titled “Anim.get_source_id(..)”Anim.get_source_id(entity : Entity, anim : Anim) : IDReturns 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"
Anim.get_state(..)
Section titled “Anim.get_state(..)”Anim.get_state(entity : Entity, anim : Anim) : AnimStateReturn 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)}
Anim.get_active_anims(.)
Section titled “Anim.get_active_anims(.)”Anim.get_active_anims(entity : Entity) : ListReturns 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));}
Anim.play(…)
Section titled “Anim.play(…)”Anim.play(entity : Entity, anim_lx : ID, time_offset : Num) : AnimPlay 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)
Anim.play_block(…)
Section titled “Anim.play_block(…)”Anim.play_block(entity : Entity, anim_block : Block, anim_instance : BlockInstance, time_offset : Num, force_parse : Bool) : AnimPlay the animation stored in a block instance on the Anim attached to
entity. This way you can play animations that are not in the asset system.
Anim.blend(…)
Section titled “Anim.blend(…)”Anim.blend(entity : Entity, anim_lx : ID, blend_time : Num, time_offset : Num) : AnimPlay 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 secondsvar anim = Anim.blend(entity, "player/idle", 0.6)
Anim.play(..)
Section titled “Anim.play(..)”Anim.play(entity : Entity, anim_lx : ID) : AnimPlay the animation asset
anim_lxon theAnimattached toentity. Plays from the beginning. Returns the newly startedAniminstance.var anim = Anim.play(entity, "player/idle")
Anim.blend(…)
Section titled “Anim.blend(…)”Anim.blend(entity : Entity, anim_lx : ID, blend_time : Num) : AnimPlay 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 secondsvar anim = Anim.blend(entity, "player/idle", 0.6)
Anim.play_only(…)
Section titled “Anim.play_only(…)”Anim.play_only(entity : Entity, anim_lx : ID, time_offset : Num) : AnimPlay 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)
Anim.play_only(..)
Section titled “Anim.play_only(..)”Anim.play_only(entity : Entity, anim_lx : ID) : AnimPlay 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")
Anim.stop(…)
Section titled “Anim.stop(…)”Anim.stop(entity : Entity, anim : Anim, reset : Bool) : NoneStop 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)
Anim.stop(..)
Section titled “Anim.stop(..)”Anim.stop(entity : Entity, anim : Anim) : NoneStop 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)
Anim.stop_all(..)
Section titled “Anim.stop_all(..)”Anim.stop_all(entity : Entity, reset : Bool) : NoneStop 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)
Anim.stop_all(.)
Section titled “Anim.stop_all(.)”Anim.stop_all(entity : Entity) : NoneStop 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)
Anim.create_track(…)
Section titled “Anim.create_track(…)”Anim.create_track(entity : Entity, anim : Anim, track_id : Any, track_type : Any) : unknownno docs found
Anim.has_track(…)
Section titled “Anim.has_track(…)”Anim.has_track(entity : Entity, anim : Anim, track_id : Any) : unknownno docs found
Anim.track_set_range(…)
Section titled “Anim.track_set_range(…)”Anim.track_set_range(entity : Entity, anim : Anim, track_id : Any, min : Any, max : Any) : unknownno docs found
Anim.track_get_range(…)
Section titled “Anim.track_get_range(…)”Anim.track_get_range(entity : Entity, anim : Anim, track_id : Any) : unknownno docs found
Anim.track_set(…)
Section titled “Anim.track_set(…)”Anim.track_set(entity : Entity, anim : Anim, track_id : Any, property : Any, value : Any) : unknownno docs found
Anim.track_set_channel(…)
Section titled “Anim.track_set_channel(…)”Anim.track_set_channel(entity : Entity, anim : Anim, track_id : Any, channel_id : Any, channel_idx : Any, interp : Any, keys : Any) : unknownno docs found
Anim.set_play_count(…)
Section titled “Anim.set_play_count(…)”Anim.set_play_count(entity : Entity, anim : Anim, play_count : Num) : NoneSet the amount of times to play the
Animinstance on theAnimattached toentity. Theplay_countvalue can be0, which will loop forever.//play 3 times and then endvar anim = Anim.play(entity, "player/idle")Anim.set_play_count(entity, anim, 3)
Anim.set_rate(…)
Section titled “Anim.set_rate(…)”Anim.set_rate(entity : Entity, anim : Anim, rate : Num) : NoneSet 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)
Anim.set_start(…)
Section titled “Anim.set_start(…)”Anim.set_start(entity : Entity, anim : Anim, start : Num) : NoneSet the start marker of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_start(entity, anim, 0)
Anim.set_end(…)
Section titled “Anim.set_end(…)”Anim.set_end(entity : Entity, anim : Anim, end : Num) : NoneSet the end marker of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_end(entity, anim, 1)
Anim.set_interval_time(…)
Section titled “Anim.set_interval_time(…)”Anim.set_interval_time(entity : Entity, anim : Anim, time : Num) : NoneSet the current playback time of the
Animinstance on theAnimattached toentity. note This API is WIP.Anim.set_interval_time(entity, anim, 0.5)
Anim.set_persist(…)
Section titled “Anim.set_persist(…)”Anim.set_persist(entity : Entity, anim : Anim, persist : Bool) : NoneSet an
Animinstance to persist after it has ended, making it stick around until stopped manually or theAnimmodifier it is on is destroyed. Only useful for niche cases like in the editor.
Anim.get_play_count(..)
Section titled “Anim.get_play_count(..)”Anim.get_play_count(entity : Entity, anim : Anim) : NumReturn the play count of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Anim.get_rate(..)
Section titled “Anim.get_rate(..)”Anim.get_rate(entity : Entity, anim : Anim) : NumReturn the rate of playback of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Anim.get_duration(..)
Section titled “Anim.get_duration(..)”Anim.get_duration(entity : Entity, anim : Anim) : NumReturn the duration of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Anim.get_start(..)
Section titled “Anim.get_start(..)”Anim.get_start(entity : Entity, anim : Anim) : NumReturn the start marker of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Anim.get_end(..)
Section titled “Anim.get_end(..)”Anim.get_end(entity : Entity, anim : Anim) : NumReturn the end marker of the
Animinstance on theAnimattached toentity.var play_count = Anim.get_play_count(entity, anim)
Anim.get_interval_time(..)
Section titled “Anim.get_interval_time(..)”Anim.get_interval_time(entity : Entity, anim : Anim) : NumReturn 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)
Anim.on_event(…)
Section titled “Anim.on_event(…)”Anim.on_event(entity : Entity, anim : Anim, fn : Fn) : Noneno docs found
AnimEvent
Section titled “AnimEvent”import "luxe: system/anim.modifier" for AnimEventno docs found
AnimEvent.start
Section titled “AnimEvent.start”AnimEvent.start : unknownAn event fired when an animation started playing.
AnimEvent.tick
Section titled “AnimEvent.tick”AnimEvent.tick : unknownAn event fired when an animation is updated, but only if the track is set to emit the event.
AnimEvent.complete
Section titled “AnimEvent.complete”AnimEvent.complete : unknownAn event fired when an animation is stopped or done playing.
AnimEvent.name(.)
Section titled “AnimEvent.name(.)”AnimEvent.name(value : AnimEvent) : unknownno docs found
AnimInterpolation
Section titled “AnimInterpolation”import "luxe: system/anim.modifier" for AnimInterpolationAn enum for types of interpolation in animation tracks.
AnimInterpolation.unknown
Section titled “AnimInterpolation.unknown”AnimInterpolation.unknown : unknownAn invalid or unknown value.
if(value == AnimInterpolation.unknown) {Log.print("unknown interpolation type!")}
AnimInterpolation.curve
Section titled “AnimInterpolation.curve”AnimInterpolation.curve : unknownThe animation values between keys will be interpolated according to the curve defined by the keys themselves.
if(value == AnimInterpolation.curve) {Log.print("curve")}
AnimInterpolation.linear
Section titled “AnimInterpolation.linear”AnimInterpolation.linear : unknownThe 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")}
AnimInterpolation.discrete
Section titled “AnimInterpolation.discrete”AnimInterpolation.discrete : unknownThe 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.name(.)
Section titled “AnimInterpolation.name(.)”AnimInterpolation.name(value : AnimInterpolation) : StringConvert an
AnimInterpolationvalue to a string.var type = AnimInterpolation.linearvar name = AnimInterpolation.name(type)Log.print("type is %(name)") //expect: "linear"
AnimInterpolation.from_string(.)
Section titled “AnimInterpolation.from_string(.)”AnimInterpolation.from_string(value : String) : AnimInterpolationGet the
AnimInterpolationvalue to a name.var type = AnimInterpolation.from_string("discrete")Log.print("discrete is value %(type)") //expect: "3", the internal value
AnimInterval
Section titled “AnimInterval”import "luxe: system/anim.modifier" for AnimIntervalno docs found
AnimInterval.create(…)
Section titled “AnimInterval.create(…)”AnimInterval.create(world : Any, duration : Any, rate : Any) : unknownno docs found
AnimInterval.create(..)
Section titled “AnimInterval.create(..)”AnimInterval.create(world : Any, duration : Any) : unknownno docs found
AnimInterval.time(..)
Section titled “AnimInterval.time(..)”AnimInterval.time(world : Any, anim : Any) : unknownno docs found
AnimInterval.set_time(…)
Section titled “AnimInterval.set_time(…)”AnimInterval.set_time(world : Any, anim : Any, time : Any) : unknownno docs found
AnimInterval.set_now(…)
Section titled “AnimInterval.set_now(…)”AnimInterval.set_now(world : Any, anim : Any, offset : Any) : unknownno docs found
AnimInterval.set_now(..)
Section titled “AnimInterval.set_now(..)”AnimInterval.set_now(world : Any, anim : Any) : unknownno docs found
AnimInterval.set_play_count(…)
Section titled “AnimInterval.set_play_count(…)”AnimInterval.set_play_count(world : Any, anim : Any, count : Any) : unknownno docs found
AnimInterval.set_clock(…)
Section titled “AnimInterval.set_clock(…)”AnimInterval.set_clock(world : Any, anim : Any, clock : Any) : unknownno docs found
AnimInterval.set_rate(…)
Section titled “AnimInterval.set_rate(…)”AnimInterval.set_rate(world : Any, anim : Any, rate : Any) : unknownno docs found
AnimInterval.set_duration(…)
Section titled “AnimInterval.set_duration(…)”AnimInterval.set_duration(world : Any, anim : Any, duration : Any) : unknownno docs found
AnimInterval.set_start(…)
Section titled “AnimInterval.set_start(…)”AnimInterval.set_start(world : Any, anim : Any, start : Any) : unknownno docs found
AnimInterval.set_end(…)
Section titled “AnimInterval.set_end(…)”AnimInterval.set_end(world : Any, anim : Any, end : Any) : unknownno docs found
AnimInterval.get_now(..)
Section titled “AnimInterval.get_now(..)”AnimInterval.get_now(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_play_count(..)
Section titled “AnimInterval.get_play_count(..)”AnimInterval.get_play_count(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_clock(..)
Section titled “AnimInterval.get_clock(..)”AnimInterval.get_clock(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_rate(..)
Section titled “AnimInterval.get_rate(..)”AnimInterval.get_rate(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_duration(..)
Section titled “AnimInterval.get_duration(..)”AnimInterval.get_duration(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_start(..)
Section titled “AnimInterval.get_start(..)”AnimInterval.get_start(world : Any, anim : Any) : unknownno docs found
AnimInterval.get_end(..)
Section titled “AnimInterval.get_end(..)”AnimInterval.get_end(world : Any, anim : Any) : unknownno docs found
AnimState
Section titled “AnimState”import "luxe: system/anim.modifier" for AnimStateAn enum for the state of an
Animinstance.
AnimState.inactive
Section titled “AnimState.inactive”AnimState.inactive : NumThe animation is inactive. :todo: This may be obsolete.
var state = Anim.get_state(entity, anim)if(state == AnimState.inactive) {Log.print("anim is inactive")}
AnimState.playing
Section titled “AnimState.playing”AnimState.playing : NumThe animation is active and is playing.
var state = Anim.get_state(entity, anim)if(state == AnimState.playing) {Log.print("anim is playing")}
AnimState.ending
Section titled “AnimState.ending”AnimState.ending : NumThe 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")}
AnimState.complete
Section titled “AnimState.complete”AnimState.complete : NumThe animation has ended and is complete.
var state = Anim.get_state(entity, anim)if(state == AnimState.complete) {Log.print("anim is complete")}
AnimState.name(.)
Section titled “AnimState.name(.)”AnimState.name(value : Num) : StringConvert an
AnimStatevalue to a string.var type = AnimState.endingvar name = AnimState.name(type)Log.print("type is %(name)") //expect: "ending"
AnimState.from_string(.)
Section titled “AnimState.from_string(.)”AnimState.from_string(value : String) : NumConvert a string to an enum value.
var state = AnimState.from_string("ending")var same = state == AnimState.ending //true
AnimUI
Section titled “AnimUI”import "luxe: system/anim.modifier" for AnimUIno docs found
AnimUI.make_field(…)
Section titled “AnimUI.make_field(…)”AnimUI.make_field(state : UIBlockState, name : String, type : BlockFieldType, view : ValueView) : unknownno docs found
AnimUI.refresh(…)
Section titled “AnimUI.refresh(…)”AnimUI.refresh(container : Any, anim_block : Any, state : Any) : unknownno docs found
import "luxe: system/anim.modifier" for Datano docs found
Variables
Section titled “Variables”var play : List = []var internal : Object = nullvar show_editor : Num = 0System
Section titled “System”import "luxe: system/anim.modifier" for Systemno docs found
System.new(.)
Section titled “System.new(.)”System.new(world : World) : Systemno docs found
System.editor_change(..)
Section titled “System.editor_change(..)”System.editor_change(entity : Entity, change : ModifierChange) : unknownno docs found