Copy link to clipboard
Copied
Hi community! I want multiple layers to rotate at different speeds. I have a character walking in the center who stops at times, I want the layers to stop rotation when she stops. At this moment I have the following expressions on rotation:
Trees: time*-4.5;
Town: time*-1.5;
Sky: time*-2.5;
I tried connecting the values to a null-slider, but when changing the value on the slider, the footage jumps back to start instead of just stopping.
Is there a solution to this?
Create a Null called 'Rotation Controller' and on that Null a Slider called "Speed".
Now go into the first layer rotation property and paste this:
speedMultiplier = -4.5;
slider = thisComp.layer("Rotation controller").effect("Speed")("Slider");
var frameRate = 25; // change accordingly to your comp setting
var somma = 0;
timef = timeToFrames(time);
var i = 0;
while ( i < timef ) {
somma += slider.valueAtTime( i/frameRate);
i ++;
}
somma*speedMultiplier
On the second layer, in the rotation property paste the
...Copy link to clipboard
Copied
You might be faster, if you just keyframe the rotation.
To make this work, you need to hold the last value.
Like the character walking for a while and the trees are rotated to 25. Then the character stops for 2 seconds, but the trees stay at 25 for those 2 seconds.
The only way to do this in AE is the stupid one: repeat the complete rotation calculation from the beginning to the given point for every frame and layer over and over again.
To calculate the rotation, you need to link it to the character. Assuming you are not using DUIK for the walk cycle, you need, for instance, the left foot movement amount, but only x and only while y has a certain value (aka when the foot is moving over the ground from the very front to the very back position) and use right foot movement amount x, when y is above a certain value (aka when left foot is over the ground and moving more in y direction then in x) and use those values as rotation, but added up frame by frame, multiplied with some abstract value for offset and fine-tuning.
Once the algorithm is set up, you just need to cycle through all frames to get your final rotation at the given point. The longer the movie and / or the more characters, the slower AE will get, since it has to calculate more and more. By slower, I mean dead slow!
I wrote an expression for DUIK which moves the character as it walks. But it turns out so slow, that I converted the expression into keyframes once the walk was set up and finished.
Have a look to get the idea:
Cheers,
Martin
Copy link to clipboard
Copied
Create a Null called 'Rotation Controller' and on that Null a Slider called "Speed".
Now go into the first layer rotation property and paste this:
speedMultiplier = -4.5;
slider = thisComp.layer("Rotation controller").effect("Speed")("Slider");
var frameRate = 25; // change accordingly to your comp setting
var somma = 0;
timef = timeToFrames(time);
var i = 0;
while ( i < timef ) {
somma += slider.valueAtTime( i/frameRate);
i ++;
}
somma*speedMultiplier
On the second layer, in the rotation property paste the same expression but change the speedMultiplier value to -1.5:
Do the same thing for the third layer and set the speedMultiplier to -2.5.
Use your slider as a gas pedal. For example set a keyframe at second 5 with value 1. At second 6 set another keyframe with value 0. The layers will keep rotating for 5 seconds and stop at 6.
It's an heavy expression if you make the comp too long.
Copy link to clipboard
Copied
....and instead of using this expression three times it's probably better if you link the second layer rotation to the first layer rotation, divide it by -4.5 and multiply it by -1.5. For the third layer rotation, divide it by -4.5 and multiply it by -2.5.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now