![]() |
![]() |
Interaction > Example: Click a button to launch an animation
Example: Click a button to launch an animation
In this example, we animate the scaling of a cube, then convert the animation into a reaction. We then place a sensor on a sphere and link the animation reaction to that sensor. When a surfer clicks the sphere, the animation plays.
Create a reaction:
- Animate the scaling of a cube growing bigger over a couple of seconds. See To animate position, rotation, or scale:.
When you turn on Play, the cube grows bigger.
- In the Sequencer, select the animation, then choose Interaction > Reactions > Play Animation.
The animation is now a reaction waiting to be triggered. It appears in the Interaction Editor. In the Parameter Editor, notice how the animation is no longer active. If you turn on the Play button, the animation does not play back.
Link a sensor to the reaction:
- Create a sphere and translate it to side of the cube.
- With the sphere selected, choose Interaction > Sensors > Mouse.
This places a mouse sensor on the sphere. The new sensor appears in the Interaction Editor.
- Expand the mouse sensor, then drag from OnLeftClick to PlayAnim.
- Switch to Browse mode to test the interaction. Click the sphere to launch the scaling animation.
![]() |
![]() |