ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling Rotation Speed

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bhavesh Jadav
Controlling Rotation Speed
on Jun 19, 2014 at 5:33:36 am

Hi,

I created fan in after effects & i want to rotate it with initial speed of zero.
Then it will increase upto certain constant speed. It will Rotate for some time at that constant speed.
After some time it will decrease value until it's value become zero. Like in real world, when u start the fan it will gradually increases it rotation speed & then rotate at constant rotation speed after some time.
When you switch off the fan, the procedure will be reversed.
Is there any way to do it in after effects?


Return to posts index

Dan Ebberts
Re: Controlling Rotation Speed
on Jun 19, 2014 at 6:14:01 am

This is one way. It's not simple, but it works:

http://www.motionscript.com/articles/speed-control.html#linear


Dan



Return to posts index

Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 19, 2014 at 9:07:17 am

Thank you for your answer
but i already checked that & i am not getting my results.
I want to do it without keyframes & speed should be controlled by slider control


Return to posts index


Dan Ebberts
Re: Controlling Rotation Speed
on Jun 19, 2014 at 2:50:27 pm

You would use that technique to integrate/accumulate the value of your slider control.

Dan



Return to posts index

Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 20, 2014 at 6:26:38 am

Thank you for answering Dan

Here's the scenario.
I have adjustment layer which has slider control, which controls the
speed of the fan. There is another layer 'Fan'. I want to control
rotation of fan layer by speed provided in slider control.
There is no keyframe in any layers. On motionscript, it calculates the area of the graph, but in my case there is no graph.so is there any modification i need to do in that code?
If there is way please tell me.


Return to posts index

Dan Ebberts
Re: Controlling Rotation Speed
on Jun 20, 2014 at 6:37:46 am

So how are you controlling the value of the slider? You initially indicated that you wanted to animate the speed of the fan, which I assume implies that you'll be animating the slider value, correct?

Dan



Return to posts index


Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 20, 2014 at 7:10:31 am

slider value is constant.
for example i enter 200 in slider value, the fan will rotate about speed of 200 rps(but not necessary 200 rps, around that value) with slowly increase its speed, 200 rps for some time & slowly decrease the speed & then stop. I am not animating slider value.


Return to posts index


Dan Ebberts
Re: Controlling Rotation Speed
on Jun 20, 2014 at 5:45:33 pm

How does the expression know how long the ramps are and when they start? If you define the ramp start and finish times in the code, I guess it would look something like this:


spd = effect("Slider Control")("Slider");
t1 = 0; // on-ramp start
t2 = 1; // on-ramp finish
t3 = 5; // off-ramp start
t4 = 6; // off-ramp finish

if (time > t4){
accum = (t2 - t1)*spd/2 + (t3 - t2)*spd + (t4 - t3)*spd/2;
}else if (time > t3){
v = linear(time,t3,t4,spd,0);
accum = (t2 - t1)*spd/2 + (t3 - t2)*spd + (time - t3)*(v+spd)/2;
}else if (time > t2){
accum = (t2 - t1)*spd/2 + (time - t2)*spd;
}else if (time > t1){
v = linear(time,t1,t2,0,spd);
accum = (time - t1)*v/2;
}else{
accum = 0;
}

value + accum



Dan



Return to posts index

Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 20, 2014 at 5:58:02 pm

Thank you for answering Dan.

According to your code the speed will increase from 0 to 1 sec & from 1 to 5 sec it wil be constant , then from 5 to 6 second it will decrease & finally it will stop. Right?
1 second ramp i want. I forgot to mention that.


Return to posts index


Dan Ebberts
Re: Controlling Rotation Speed
on Jun 20, 2014 at 6:07:09 pm

That's correct.



Return to posts index

Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 20, 2014 at 6:10:21 pm

Oh Great.
Thank you Dan.
I will let u know if it works.
Thank you.


Return to posts index

Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 21, 2014 at 7:09:58 am
Last Edited By Bhavesh Jadav on Jun 21, 2014 at 7:15:10 am

I checked expression Dan.
the post expression graph looks like this

Well it work for on-ramp start then it stopped rotating.
I think the graph should look like the post expression speed graph on the motionscript.com.

The cyan colored graph.
PS : I changed the value of t1, t2, t3, t4
here's the new value
t1=2
t2=3
t3=7
t4=8


Return to posts index


Bhavesh Jadav
Re: Controlling Rotation Speed
on Jun 22, 2014 at 2:17:09 pm

Hi Dan,

It really work well. I was misunderstood & confuse of that graph thing & sorry for that.
but only one issue that on on-ramp start & off-ramp start it rotates so fast compare to the speed in between on-ramp start & off-ramp start, but that is unnoticeable.
Thank you very much Dan.


Return to posts index

Ernestas Cepulionis
Re: Controlling Rotation Speed
on Mar 3, 2017 at 5:32:06 am

Hi,

I studied math of this expression and I can't find out why did you divided some values by 2?

.....
(t2 - t1)*spd/2
(t4 - t3)*spd/2;
(time - t3)*(v+spd)/2;
(time - t1)*v/2;
....

spd = effect("Slider Control")("Slider");
t1 = 0; // on-ramp start
t2 = 1; // on-ramp finish
t3 = 5; // off-ramp start
t4 = 6; // off-ramp finish

if (time > t4){
accum = (t2 - t1)*spd/2 + (t3 - t2)*spd + (t4 - t3)*spd/2;
}else if (time > t3){
v = linear(time,t3,t4,spd,0);
accum = (t2 - t1)*spd/2 + (t3 - t2)*spd + (time - t3)*(v+spd)/2;
}else if (time > t2){
accum = (t2 - t1)*spd/2 + (time - t2)*spd;
}else if (time > t1){
v = linear(time,t1,t2,0,spd);
accum = (time - t1)*v/2;
}else{
accum = 0;
}

value + accum


Return to posts index

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