ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# If don't move, keeps rotating.

FAQ   •   VIEW ALL
 If don't move, keeps rotating. on Aug 5, 2019 at 11:33:26 pm

Hey Guys,

I did part of a expression, but I don't know how to solve part of it.
I need that the rotation keeps going when you don't have movement on "b" (y pos). I just knew how to do it when the Pos is specific, like now = 640.

The idea is when not moving rotate 20º each 1sec, if is moving rotate 1º per pixel.

Gus

a = time*20;
b = transform.position[1]*-1;
p = transform.position[1];
if (p == 640) {a
}else{
b
}

 Re: If don't move, keeps rotating.on Aug 7, 2019 at 7:22:38 am

Is this what you are after?

a = time*20;
b = transform.position[1]*-1;
p = transform.position;
if (p.velocityAtTime(time)[1] > 0) {a
}else{
b
}

Andrei
My Envato portfolio.

 Re: If don't move, keeps rotating.on Aug 7, 2019 at 11:34:02 pm

Thank you Andrei,

But to work I change the > 0 to ==0, then I have another issue. I have a standart rotation that if not moves is 20º, but when start moving it grabs the Y pos (that start on 0 Y pos) then the rotation that is 20º already jump to 0º, the same when stop.

Any thought on how to solve this?
I tried to add, value + time*20 but didn't work.

Thanks,
Gus

 Re: If don't move, keeps rotating.on Aug 8, 2019 at 10:33:17 am

It's a bit more complicated but we can find a workaround. Just tell me some more details of its movement. Does it move using keyframes? And how many? Does it stop after it starts moving?

Andrei
My Envato portfolio.

 Re: If don't move, keeps rotating.on Aug 9, 2019 at 2:33:14 am

Thank you Andrei for helping me on this.

The idea Nisan slider that the "knob" keeps rotation very slow (time*20). But when in movement (keyframes) it moves 1º per pixel. My comp is 500px height. But the idea is when the movement is slow it rotates slow and the movement is fast it rotates fast. Then when stop, keep the rotation (time*20).

But since it is already rotating when is stoped, when start moving it should keep the value of the rotation the you already have to not have a jump.

I hope that make sense.

Thank you again,
Gus