Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions If don’t move, keeps rotating.

  • If don’t move, keeps rotating.

    Posted by Gus Favoreto on August 5, 2019 at 11:33 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.

    Thank you in advance,
    Gus

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

    Gus Favoreto replied 6 years, 12 months ago 2 Members · 4 Replies
  • 4 Replies
  • Andrei Popa

    August 7, 2019 at 7:22 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.

  • Gus Favoreto

    August 7, 2019 at 11:34 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

  • Andrei Popa

    August 8, 2019 at 10:33 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.

  • Gus Favoreto

    August 9, 2019 at 2:33 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy