ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing Rotation In Offset

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
liran lin
Changing Rotation In Offset
on May 25, 2020 at 10:27:27 am
Last Edited By liran lin on May 25, 2020 at 4:46:50 pm

Hi,
I have a COMP with layers that i Can Control there Z Deph and X and Y Position, But i Cant Change there Rotation with a CONTROLLER and with a little Offset in Between them.

I'm Trying to do 2 things.

1. To change to rotation of multi layers with a Little offset in between them, and connecting to a rotation controller so i Could the Value of the offset.
2. I would like to make a Delay in the Position and Rotation in the layers Which will follow the Main Layer After Im making a Keyframe animation for the main layer.

I Hope i Explained myself OK.

Thanks in advance
Liran



//Position controller
z = (index-1)*thisComp.layer("CONTROL").effect("Z")("Slider");
x = (index-1)*thisComp.layer("CONTROL").effect("X")("Slider");
y = (index-1)*thisComp.layer("CONTROL").effect("Y")("Slider");

[value[0]+x,value[1]+y,value[2]+z];


Return to posts index

Robert Müller
Re: Changing Rotation In Offset
on May 26, 2020 at 9:37:53 am

Hi,
First for the delay, you should reference the position of your original layer like this:
//Position controller
z = (index-1)*thisComp.layer("CONTROL").effect("Z")("Slider");
x = (index-1)*thisComp.layer("CONTROL").effect("X")("Slider");
y = (index-1)*thisComp.layer("CONTROL").effect("Y")("Slider");

delay=0.5; //delay in seconds
mainPos=thisComp.layer("Main_layer").transform.position.valueAtTime(time-delay);

[mainPos[0]+x,mainPos[1]+y,mainPos[2]+z];


And for the rotation its pretty similar with angle controlls instead of sliders (nore: I used the orientation property so that I only have one expression for all the angles)
//Rotation controller
rotX = (index-1)*thisComp.layer("CONTROL").effect("rot.X")(1);
rotY = (index-1)*thisComp.layer("CONTROL").effect("rot.Y")(1);
rotZ = (index-1)*thisComp.layer("CONTROL").effect("rot.Z")(1);

delay=0.5; //delay in seconds
mainRot=thisComp.layer("Main_layer").transform.orientation.valueAtTime(time-delay);

[mainRot[0]+rotX,mainRot[1]+rotY,mainRot[2]+rotZ];


Note that if you have a controll layer and a Main layer, you might have to change the index calculation, depending on how your layers are arranged.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]