ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to jump back into first position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Saez
Expression to jump back into first position
on Apr 2, 2019 at 4:31:39 am

Hey everybody,

I'm trying to set up an expression on the X-Position property to be linked to a rotation property on a null to have it move with the rotation to give a fake 3D effect.

The problem I'm having is that I can get the layer move from point A to point B but when the rotation goes over 360, I don't know how to put the layer back into the beginning position and move along with the rotation going over 360 to loop.

So far this is what I have:

r = thisComp.layer("RocketShip - Rotator").transform.yRotation;
p = transform.xPosition;

if (r&lt;360)
linear(r,90,360,p+180,p)
else
linear(r,360,720,p,p-180);


Return to posts index

Andrei Popa
Re: Expression to jump back into first position
on Apr 2, 2019 at 7:54:12 am

Not entirely sure about what you want to achieve, but this could be helpful. Modify maxDistance for a wider circle

r = thisComp.layer("RocketShip - Rotator").transform.yRotation;
maxDistance = 1000;

value - Math.sin(Math.PI*r/180)*maxDistance;


Andrei
My Envato portfolio.


Return to posts index

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