Animation
The animation component animates an entity according to a collection of keyframes. For more details on all properties associated with the animation component and how to use the animation with scripting, please see the API documentation.
The animation component is typically used for very simple animations, such as camera animations for recording videos. Note that scrolling through the timeline does not preview the animation. You must run the simulation to test the animation. Do not use the animation component for machines/robots/mechanisms. You should use the physics component with joints and motors instead.
Workflow
The general procedure to animate an entity:
- Add the animation component to the entity that you want to animate.
- Scroll through the timeline to the time at which you want to create a keyframe.
- Move, rotate and scale the entity to the position, orientation and scale that you want at that keyframe.
- Click the add button to add a keyframe and adjust the interpolation mode as desired.
- Repeat steps 2-4, adding any additional keyframes.
Properties
The animation component properties that are accessible through the inspector.
Timeline
The timeline contains the keyframes for the animation. A keyframe stores the state of the transform component for the entity (local position, rotation and scale) and the interpolation mode. You can move the timeline forwards and backwards using the scroll wheel on your mouse. Scroll downwards to move forwards in time, and scroll upwards to move backwards in time (100ms increments). You can hold SHIFT and scroll to move the timeline faster (1s increments).
The buttons under the timeline perform the following actions:
- Add: Add a new keyframe to the timeline at the marked time.
- Remove: Remove a keyframe from the timeline, if a keyframe exists at the marked time.
- Previous: Move the marker to the previous keyframe.
- Backwards: Move the marker backwards 100ms.
- Forwards: Move the marker forwards 100ms.
- Next: Move the marker to the next keyframe.
- Copy/Paste: Click to copy the keyframe. Click again to paste the keyframe.
- Transition: Update the interpolation mode for the keyframe.
The keyframe interpolation mode is one of the following values:
- Linear: Linearly interpolates between keyframes.
- EaseIn: Eases in between keyframes, increasing speed over time.
- EaseOut: Eases out between keyframes, decreasing speed over time.
- EaseInOut: Eases in and out between keyframes, accelerating and then decelerating.
- Step: Teleports between keyframes (step function).
Repeat
Causes the animation to cycle after reaching the last keyframe.