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.
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.
To create a new animation 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:
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:
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.
The simplest thing you can do is to make an animation play in response to a user interaction.
To do this:
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.
Choose an animation to control with the playback controller.
This will always say animation, because this playback controller controls animations.
The duration of the animation.
Create a patch to control when the animation starts to play.
Check this box to continuously loop the animation when the effect is opened.
Create a patch to reset the animation.
Use this slider to adjust the speed of the animation.
The 3D object that contains the animation.