Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions moving a layer over time

  • moving a layer over time

    Posted by Alex Dinnin on January 14, 2008 at 10:03 am

    I am just wondering if there was a way to move a layer’s position in x over time..

    so let’s say every five frames the layer moved 10 pixels in x,
    but y stayed the same.

    I have had a look around and couldn’t really find anything.. and if I am honest, I didn’t really understand the time command at all.. so some pointers to any tuts on that would be great !!

    thanks in adavance

    have a great week

    Alex

    Cutter Johnston replied 15 years, 5 months ago 4 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    January 14, 2008 at 3:55 pm

    i would probably use something like this…

    x = (time / thisComp.frameDuration) * 10;
    value + [x, 0]

    the first part of the expression — (time / thisComp.frameDuration), converts the frame duration to a frame number to be used with the multiplier (10) to increase over time.

    that last part of the expression just uses the position value at the first frame and adds the calculated x value (note to add arrays, both values need to be arrays, so since the position value is an array [x,y] the the new position value also needs to be expressed as an array, thus [x, 0], where the y value has no change).

    hope this helps….

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Alex Dinnin

    January 14, 2008 at 4:12 pm

    Thanks Kevin…

    I see what you have done.. what I was really looking for was a more jerky movement.. so at frame 5 it moves 20 pixels then frame 10 another 20 etc etc..

    I will have a play about as I think this needs a lin interpolation…

    will get back you with results..

    thanks again

    Alex

  • Kevin Camp

    January 14, 2008 at 4:49 pm

    sorry, i really should read more carefully….

    all you need is the posterizeTime() command which will tell ae to sample at a set number of times per second.

    so the expression would be like this:

    posterizeTime(6);
    x = (time / thisComp.frameDuration) * 2;
    value + [x, 0]

    when adjusting the posterizeTime(), just remember that the value is in times/second, not every frame or anything like that. also the offset (multiplier) value needed to change since it is getting calculate every frame, but only being updated every 5th frame, so that value changed from 10 to 2.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kristobal Reynaldo

    December 16, 2008 at 3:47 am

    Hey! I hope i’m right when i say this… So what you’re saying is that you want the layer to move to a certain direction. right? Well anyway go to effects and search for this effect called transform. Apply Transform to a layer and apply time-stamp as well. You must use the circular thing lol, to move the layer and with the time stamp applied, it will move over time

  • Cutter Johnston

    November 24, 2010 at 1:04 pm

    Thanks Kevin! Your 2 year old expression helped me move my troop of 225 soldiers (layers) perfectly over time using one null object. NICE!

    x = (time / thisComp.frameDuration) * 10;

    value + [x, 0]

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