LS.Animation.Track Class
Represents one track with data over time about one property Data could be stored in two forms, or an array containing arrays of [time,data] (unpacked data) or in a single typed array (packed data), depends on the attribute typed_mode
Constructor
LS.Animation.Track
()
Item Index
Methods
addKeyframe
-
time -
value -
skip_replace
Adds a new keyframe to this track
Parameters:
-
timeNumbertime stamp in seconds
-
valueanything you want to store
-
skip_replaceBooleanif you want to replace existing keyframes at same time stamp or add it next to that
Returns:
index of keyframe
findTimeIndex
-
time
returns nearest index of keyframe with time equal or less to specified time (Dichotimic search)
Parameters:
-
timeNumber
Returns:
index
getIDasName
-
use_basename -
root
used to change every track so instead of using UIDs for properties it uses node names this is used when you want to apply the same animation to different nodes in the scene
Parameters:
-
use_basenameBooleanif you want to just use the node name, othewise it uses the fullname (name with path)
-
rootLS.SceneNode
Returns:
the result name
getKeyframe
-
index
returns a keyframe given an index
Parameters:
-
indexNumber
Returns:
the keyframe in [time,data] format
getKeyframeByTime
-
time
returns the first keyframe that matches this time
Parameters:
-
timeNumber
Returns:
keyframe in [time,value]
moveKeyframe
-
index -
new_time
changes a keyframe time and rearranges it
Parameters:
-
indexNumber -
new_timeNumber
Returns:
new index
packData
()
takes all the keyframes and stores them inside a typed-array so they are faster to store in server or work with
removeKeyframe
-
index
removes one keyframe
Parameters:
-
indexNumber
trim
-
start -
end
removes keyframes that are before or after the time range
Parameters:
-
startNumbertime
-
endNumbertime
unpackData
()
takes all the keyframes and unpacks them so they are in a simple array, easier to work with
