Property Animation Component
The property animation component plays a property animation asset. The asset describes which properties on which objects and components change over time; the component drives that playback on the game object it is attached to and its children.
Component Properties
-
Animation: The property animation asset to play. -
Playing: Whether the animation is playing. Disable this to start paused, then use theplMsgSetPlayingmessage to start playback from game code. -
Mode: How to play the animation:Once: The animation is played exactly once and then stops.Loop: The animation is played in an endless loop.BackAndForth: The animation is played to its end, then it reverses and plays back to the start. Then the cycle repeats.
-
RandomOffset: A random amount of time by which the playback start is shifted. Use this when many copies of the same object play the same animation, so that they don't all move in lockstep. -
Speed: The playback speed. A negative speed plays the animation backwards. There is no message to change the speed at runtime; modify the property instead. -
RangeLow,RangeHigh: Restricts playback to a time range within the animation. This lets you store several animations in one asset and play only a section of it.
Controlling Playback from Code
- Send
plMsgSetPlayingto the component to pause or resume playback. This does not reset the playback position. - Call
PlayAnimationRange(rangeLow, rangeHigh)to set a new playback range and restart playback. Positive speed starts at the low end; negative speed starts at the high end. The configured random offset can shift that position. The component must be active. This function is exposed to scripts.
Events
- Every time the playback position passes a marker in the asset's event track, the component broadcasts
plMsgGenericEventwith the marker's name. This is the same mechanism as animation events on animation clips. - When playback reaches the end of the animation (or of the selected range), the component broadcasts
plMsgAnimationReachedEnd.
Both are event messages, so they are delivered to event handler components on the same object or a parent, such as visual scripts.