Playing Baked Animations

If you've added a 3D object with an animation included in the file, you can use the animation playback controller to easily set when the animation plays, stops and pauses.

Learn about:

For more complex effects with baked-in animations, like switching between more than one animation or controlling progress, you'll need to use other patches.

To set how each joint in a 3D object's skeleton moves, follow this guide to animating an object with a skeleton.

Creating an animation playback controller

To create a new animation controller:

  1. Click Add Asset at the bottom of the Asset panel.
  2. Select Animation Playback Controller.

The animation playback controller will be listed in the Assets panel.

“Kako” by manoeldarochadeoliveira is licensed under CC BY 2.0

You'll need to assign the animation playback controller to the object in the scene that you want to animate. To do this:

  1. Select the object in the Scene panel.
  2. Go to the Inspector.
  3. Next to Animation, select the animation playback controller from the dropdown list.

Adding the animation to the playback controller

The animation needs to be connected to the animation playback controller.

The animations your object contains will be listed in the Assets panel:



To connect an animation to an animation playback controller:

  1. Select the animation playback controller in the Assets panel.
  2. In the Inspector, click the dropdown next to Animation.
  3. Select the animation you want to control.

Starting, Stopping and pausing the animation

If you select the animation playback controller in the Assets panel you'll see 3 options under Properties in the Inspector - Play, Loop and Reset.



When the box next to Loop is checked the animation will play on a loop as soon as the effect is opened.

Clicking the arrows next Play and Reset will create patches to represent these properties. You can connect these to other patches to configure when the animation plays and resets - for example in response to an interaction from the person using your effect.

Starting an animation in response to interaction

The simplest thing you can do is to make an animation play in response to a user interaction.

To do this:

  1. Click the arrow next to Play. This will create a patch and open the Patch Editor.
  2. Right-click in the Patch Editor and select any interaction patch that creates a boolean signal (a signal that's either on, or off). For example, the Mouth Open, Screen Tap and Happy Face patches.

If you connect the output of the interaction patch to the Play input port in the animation playback controller patch a Switch patch will be created automatically. Joining these 3 patches together creates a switch that will turn the animation on or off each time the screen is tapped.

Here's how your graph will look:



Select Simulate Touch in the Simulator to test the effect. The animation should play when you click the screen:



If you connect a patch representing the Reset property instead of the Play property the animation will reset instead.

Animation playback controller - properties

Animation Clip

Choose an animation to control with the playback controller.

Type

This will always say animation, because this playback controller controls animations.

Duration

The duration of the animation.

Play

Create a patch to control when the animation starts to play.

Loop

Check this box to continuously loop the animation when the effect is opened.

Reset

Create a patch to reset the animation.

Speed

Use this slider to adjust the speed of the animation.

Used By

The 3D object that contains the animation.