ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Rotation expression to rotate each layer below 22.5 degrees less

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Erik reinholdz
Rotation expression to rotate each layer below 22.5 degrees less
on Mar 26, 2020 at 4:29:44 pm

I am new to expressions and am trying to rotate multiple shape layers. So far I keyframed the top layer to rotate around the z axis 360 degrees. There is a slider on the first layer that controls the time offset and an index/value at time expression on the layer below. The problem is that every layer rotates 360 degrees and I want each layer below when duplicated to rotate 22.5 degrees less and all ease in and out. The expression I used is:

timeoffset = thisComp.layer("top card").effect("Slider Control")("Slider");

thisComp.layer("top card").transform.rotation.valueAtTime(time - ((index - 1) * timeoffset))



layer 1 360

layer 2 337.5

layer 3 315 etc.



I would appreciate some suggestions. Thank you.






timeoffset = thisComp.layer("top card").effect("Slider Control")("Slider");

thisComp.layer("top card").transform.rotation.valueAtTime(time - ((index - 1) * timeoffset))


Return to posts index

Andrei Popa
Re: Rotation expression to rotate each layer below 22.5 degrees less
on Mar 26, 2020 at 6:27:37 pm

This will work with normal easing:


masterLayer = hisComp.layer("top card");
timeoffset = masterLayer.effect("Slider Control")("Slider");
duration = masterLayer.rotation.key(2).time-masterLayer.rotation.key(1).time;
idx = index-1;
delay = timeoffset*idx;
maxValue = 360-22.5*idx;
ease(time,delay,delay+duration,0,maxValue);


Andrei
My Envato portfolio.


Return to posts index

Erik reinholdz
Re: Rotation expression to rotate each layer below 22.5 degrees less
on Mar 27, 2020 at 9:16:15 pm

Thank you! This worked great! I'm probably pushing my luck, but do you know how I could add to the expression to have each layer also rotate around their x axis in the center of the shape? In other words each layer would have an additional centered anchor point to rotate around with ease and ideally be controlled by another slider.


Return to posts index


vahab san
Re: Rotation expression to rotate each layer below 22.5 degrees less
on Mar 26, 2020 at 8:48:35 pm
Last Edited By vahab san on Mar 26, 2020 at 9:00:27 pm

Hey

Try this:

to = effect("time ofset")("Slider");
t = thisComp.layer(index-1).transform.rotation.valueAtTime(time-to);
v2 = thisComp.layer(1).transform.rotation.key(2).value-((index-1)*22.5);
t >= v2 ? v2 : t;


Return to posts index

Erik reinholdz
Re: Rotation expression to rotate each layer below 22.5 degrees less
on Mar 27, 2020 at 9:24:19 pm

Thank you! This one also worked really well. The only difference was that I think had to move the slider to the second layer to make it work. Therefore to make adjustments I have to delete all the below layers, adjust the slider and reduplicate.


Return to posts index

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