Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Add new keyframe using expression?

  • Add new keyframe using expression?

    Posted by Noel Powell on March 13, 2013 at 3:18 pm

    I’m looking to add a new keyframe with a specific value at a specific frame, using the values from a slider control to define that value and frame number. Or, if I could change the value and time of an existing keyframe using the slider controls, that would work just as well. Is this possible?

    Here’s my situation: I have a layer that is continuously moving because of a time*x expression on the position parameter. I need this layer to loop, or repeat itself, after it reaches a certain frame or value. The catch is that the frame or value will change based on the values of the slider controls. I’ve tried multiple things, but I can’t figure this out. I figured if I can create a keyframe based on the slider control values, then I can add a loopOut(type=”cycle”) expression to loop it. If there is another way of doing this, please share.

    Thank you in advance.

    After Effects templates and VFX solutions – https://CreationEffects.com

    Noel Powell replied 13 years, 5 months ago 3 Members · 4 Replies
  • 4 Replies
  • Todd Kopriva

    March 13, 2013 at 8:30 pm

    You can’t add keyframes with expressions. With scripts, yes.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    After Effects quality engineering
    After Effects team blog
    ———————————————————————————————————

  • Noel Powell

    March 14, 2013 at 11:05 pm

    Thanks Todd, that’s what I was afraid of. Let me rephrase and if you can think of another way to do this then great. If not, thanks anyway.

    I have a layer in motion powered by an expression, not keyframes. I need it to start its motion over and over again at intervals. So every X number of frames, it should repeat the motion. X value is based on a slider control input.

    Here’s what I have so far:
    cycleEnd is the time (in seconds) that the motion should start over

    motion = (time * 30) * -thisComp.height; //Moves the layer one comp height every frame
    if (time > cycleEnd)
    { yVal = ((time - cycleEnd) * 30) * -thisComp.height }
    else { yVal = motion }
    value + [value[0], yVal]

    After Effects templates – lens flares, light leaks, old film effects, digital glitches, VHS glitches, and more: https://CreationEffects.com

  • Dan Ebberts

    March 14, 2013 at 11:14 pm

    I’m not sure exactly what you’re trying to do, but I think you just need the modulus operator (%) to create your cycles. Something like this:

    t = time%cycleEnd;
    y = t*30*thisComp.height;
    value – [0,y]

    Dan

  • Noel Powell

    March 15, 2013 at 12:05 am

    This is perfect! So elegant and simple. I have much to learn…
    Thank you, Dan!

    After Effects templates – lens flares, light leaks, old film effects, digital glitches, VHS glitches, and more: https://CreationEffects.com

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