Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change position every 3rd frame

  • Change position every 3rd frame

    Posted by Y. Bar on April 21, 2010 at 12:05 pm

    Hello,

    I have a layer which I animate between 2 position keyframes.
    I would like this layer to move from one position key to the next, by changing its position not every frame, but once every 3 frames.

    How can I achieve this?

    Thanks,
    Yaron.

    Dan Ebberts replied 16 years ago 3 Members · 8 Replies
  • 8 Replies
  • Lloyd Alvarez

    April 21, 2010 at 12:24 pm

    frameInterval = 3;
    fps= 1.0 / thisComp.frameDuration;
    posterizeTime(fps/frameInterval);
    value;

    Lloyd

    https://aescripts.com

  • Y. Bar

    April 21, 2010 at 7:15 pm

    I don’t understand how to use this expression.

    I need to keep the position between the 2 keyframes I set already, only to make the transition between them occur instead of every single frame – every 3rd frame.

    By the way, is there a way to populate the entire timeline between 2 keyframes with keyframes automatically ? (instead of scrolling forward every frame and adding a keyframe)

    At least a way to set a shortcut to ‘Add Keyframe’ ?

    Thanks.. Yaron.

  • Lloyd Alvarez

    April 21, 2010 at 7:27 pm

    You need to apply that expression to the position property. Alt-click on the timewatch icon for position and copy and paste the expression into the text field that opens.

    The shortcut to add a keyframe for position is Alt-P

    -Lloyd

    https://aescripts.com

  • Dan Ebberts

    April 21, 2010 at 8:35 pm

    As I recall, posterizeTime() can be a little temperamental in CS4, so if you can’t get it to work, you could try it this way:

    t = framesToTime(Math.floor(timeToFrames()/3)*3);
    valueAtTime(t)

    For creating keyframes at every frame, you can create the default expression (Alt+click the stopwatch) then use Animation>Keyframe Assistant>Convert Expression to Keyframes. Then you may want to delete the keyframes before and after your span of interest.

    Dan

  • Lloyd Alvarez

    April 21, 2010 at 9:01 pm

    Hey Dan,

    What do you mean by temperamental? I’ve never had any issues with posterizeTime.

    -Lloyd

    https://aescripts.com

  • Dan Ebberts

    April 21, 2010 at 9:16 pm

    Mostly it doesn’t work. I just tried this on a keyframed solid’s position in a 30fps comp:

    posterizeTime(10);
    value;

    It doesn’t have any effect. This is only CS4 I’m talking about.

    Dan

  • Lloyd Alvarez

    April 21, 2010 at 10:02 pm

    Wow! you are right, when I tested the expression i posted in this thread I did it in CS5 and it worked fine but when I just tried it in CS4 it doesn’t work. I can’t believe I didn’t know about this, thanks for pointing it out. I am assuming that since it is fixed in CS5 it was a known bug.

    https://aescripts.com

  • Dan Ebberts

    April 21, 2010 at 10:12 pm

    Yeah, somebody here ran into it last year some time. I reported it in case no one else had.

    Dan

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