## Rotate layer with condition

Scripting for After Effects

### Rotate layer with condition

Hello!

I would like to create rotating 3D layers, much like a pages of the book.

I would create pages and link them to a null that I would use as a master control for rotation.

Condition I would like to create is that when one page rotates completely from 0 to 180 degrees, it triggers next page to rotate and stops first page.

So I would need to add some kind of an expression to second page that would trigger rotation when Y rotation value on null reaches 180 and some expression to first page that would stop rotation when value on null reaches 180.
Sasha dal Ponte
motion graphics designer

.: MY VIMEO PORTFOLIO :.

sasa.dalponte@gmail.com
Sasha dal Ponte

Posts: 2010
Joined: 05/22/2009, 5:14 am
Location: Kutina, Croatia

### Re: Rotate layer with condition

Hello,

eventually you can modify this Expression:

http://motionscript.com/design-guide/audio-trigger.html

Hans
hans123

Posts: 1082
Joined: 12/28/2012, 1:37 am
Location: Paris / France

### Re: Rotate layer with condition

Assuming you have a 3D null "Null 1" that you rotate on the Y axis, create a 3D solid as the top layer with the anchor point at the left edge, place the solid so the left edge is approximately in the vertical center of the comp.

Add the following expression to the Y rotation of the solid.

Code: Select all
`Math.min(180, Math.max(0, thisComp.layer("Null 1").transform.yRotation-180*(index-1)))`

Duplicate solid a number of times. Animate the Y rotation of the 3D null.
star+circle

Posts: 741
Joined: 12/6/2014, 3:07 pm
Location: Finland

### Re: Rotate layer with condition

Creating a trigger or using the values of a Null directly would be as simple as using a modulus (%180).

Mylenium
[Pour Mylène, ange sur terre]
----------------------------------------
www.myleniumblog.com
Mylenium

Posts: 3263
Joined: 02/1/2009, 11:45 am
Location: Germany
System Specs: Have, I do!