As a result of the coronavirus (COVID-19) outbreak, we have a reduced capacity to review effects and delays in publishing are expected. Learn more.
You can use logic to make something happen in your effect in response to a specific set of conditions.
In this guide, you'll learn to use the Or patch to make something happen if either of two interactions are detected. We'll use the Head Rotation patch to animate an object when the head either leans to the left, or the right:
To follow this guide, add an object to your Spark AR Studio project. For example your own 3D object, an object from AR Library or a plane.
Start by animating an object in the scene using animation patches:
Set the positions the object rotate between in the Transition patch:
Finally, check the box next to Mirrored in the Loop Animation patch, to play the animation forwards then backwards.
Your graph should look like this:
And your object should be rotating:
Right-click in the Patch Editor and select;
The Head Rotation patch is a face landmark patch. It needs to receive data from the face tracker, so add a face tracker to your scene and drag it into the Patch Editor to create a patch.
The output of the Or patch to the Enable input in the Loop Animation patch.
Your final graph should look like this:
As a result, the animation will play if the head leans either left or right.