Learn Spark AR Studio

Everything you need to know to create an interactive augmented reality experience.


Using the Or Patch

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 make something happen when the head either leans to the left, or the right. The behaviour these patches will drive is the animation of an object, using the Loop Animation and Transition patches to move the object between two different positions.

Add an object to your scene

To follow this guide, add an object to your scene - for example, your own 3D object, an object from the AR Library, or a plane.

Create the animation patches

Let's start by animating an object in the scene:

  1. Right-click in the Patch Editor and select a Loop Animation and Transition patch.
  2. Select your object in the Scene Panel, and click the arrow next to Rotation in the Inspector.


  1. The Progress output in the Loop Animation patch to the Progress input in the Transition patch.
  2. The output of the Transition patch to the patch representing the rotation of the object.

Set the positions the object rotate between in the Transition patch:

  1. Next to End, set Y to 360

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:

Adding logic with the Or patch

Right-click in the Patch Editor and select a Head Rotation patch, and an Or Patch.

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 Face output in the face tracker patch to the Face input in the Head Rotation patch.
  • The Turned Left and the Turned Right outputs from the Head Rotation patch to the inputs in the Or patch.

The output of the Or patch to the Enable input in Loop Animation.

Your final graph should look like this:

As a result, the animation will play if the head leans either Left or Right:

Join the Spark AR Creator's community

Find inspiration, see examples, get support, and share your work with a network of creators.

Join Community

Frequently asked questions

Have a specific question? Maybe it's been answered.

Read FAQs
Was this document helpful?