Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Move Object from pixels every “x” second | Bpm metronome

  • Move Object from pixels every “x” second | Bpm metronome

    Posted by Fu Wushu on July 30, 2017 at 5:36 am

    Hi everyone,

    I’m very new to expression in after effects and i was wondering how to change the position of an object every “x” second, for example every sec, the object move to position A to position B ?

    I heard there’s posterize time, but i don’t know how to completely write it. I got the object to slide from A to B, but i just want them to move from A to B.

    And at the end of the bar, i would like to loop it. Is it possible ?

    It would be like a metronome, every x second, it moves one square :

    Thank you for your help !

    Andrei Popa replied 8 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Andrei Popa

    July 31, 2017 at 10:45 am

    This is a solution, but you`ll have to do some math. Calculate the steps you need until you get to B.
    steps = 5;
    dist = thisLayer.sourceRectAtTime(time,false).width;
    sec = 3;
    tempX = value[0]+(Math.round(time/sec)%steps)*;
    [tempX,value[1]];

    If you want to move it more than just its own size to the right, just add something to the dist variable. Sec is the interval between the moves in seconds and steps is how many times before repeating. You can add slider to this variables for an easier modify.

    Andrei

  • Andrei Popa

    July 31, 2017 at 11:05 am

    I misscopied the expression:

    steps = 5;
    dist = thisLayer.sourceRectAtTime(time,false).width;
    sec = 3;
    tempX = value[0]+(Math.round(time/sec)%steps)*dist;
    [tempX,value[1]];

    Andrei

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