Rotate layer with condition

Scripting for After Effects

Rotate layer with condition

Postby Sasha dal Ponte on 11/6/2015, 2:19 am


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

Sasha dal Ponte
Posts: 2010
Joined: 05/22/2009, 5:14 am
Location: Kutina, Croatia
Twitter: sasadalponte

Re: Rotate layer with condition

Postby hans123 on 11/6/2015, 7:44 am


eventually you can modify this Expression:

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

Re: Rotate layer with condition

Postby star+circle on 11/7/2015, 1:58 pm

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.
Posts: 741
Joined: 12/6/2014, 3:07 pm
Location: Finland

Re: Rotate layer with condition

Postby Mylenium on 11/19/2015, 12:48 am

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

[Pour Mylène, ange sur terre]
Posts: 3263
Joined: 02/1/2009, 11:45 am
Location: Germany
System Specs: Have, I do!

Return to After Effects Expressions