Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions get a value at a certain keyframe

  • get a value at a certain keyframe

    Posted by Tom Gomez on May 29, 2013 at 10:42 pm

    Greetings Folks,

    Looking for a simple way to grab a value of a given property of a given layer at a certain keyframe on that property.

    Specifically, I’ve got a shape layer with a keyframed rectangle width (just two keyframes). I’m creating a matching rectangle that needs to START with the width the first one ended at.

    Thanks so much! People in this forum are amazing.

    -Tom

    ================================================
    YOU can help save TimeSpace. Join the Chronos Protectorate!

    https://www.95ers.com
    https://www.SpaceAceMedia.com

    Eduardo Asta replied 6 years, 9 months ago 4 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    May 29, 2013 at 11:31 pm

    Something like this should work:

    s = thisComp.layer(“Shape Layer 1”).content(“Rectangle 1”).content(“Rectangle Path 1”).size;
    s.valueAtTime(s.key(s.numKeys).time)[0]

    Dan

  • Tom Gomez

    May 30, 2013 at 3:58 pm

    As always thanks so much Dan.

    It was giving me an error (something about 2 dimensions) with the [0] so I removed it and it worked like a charm. Any idea why?

    Quick question: Where in that expression does it tell it to look at the second keyframe?

    ================================================
    YOU can help save TimeSpace. Join the Chronos Protectorate!

    https://www.95ers.com
    https://www.SpaceAceMedia.com

  • Dan Ebberts

    May 30, 2013 at 4:18 pm

    >Any idea why?

    You mentioned that you wanted the width, so the [0] isolates the width part of the 2D size parameter.

    >Where in that expression does it tell it to look at the second keyframe?

    The expression looks for the last keyframe, which is what s.numKeys does.

    Dan

  • Eduardo Asta

    July 19, 2019 at 4:06 pm

    Hello Dan,

    I have a similar problem. I have a shape layer with two key frames on Trim Paths. I want to grab the second Trim Paths keyframe value and link it to a slider.

    Do you if it is possible?

  • Tomas Bumbulevičius

    July 19, 2019 at 8:30 pm

    Eduardo – you can’t alter the value of keyframe itself by a slider.

    Instead of using keyframes, you could use interpolation methods, which can be controlled by sliders then.

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Eduardo Asta

    July 19, 2019 at 10:07 pm

    Hello Thomas,

    I guess my question wasn’t clear. I could solve my problem using, yes, a liner method.

    Thanks for the website you sent to me. I didn’t know it.

    if (numKeys > 1){
    t1 = key(1).time;
    t2 = key(2).time;
    v1 = 0;
    v2 = effect("Posicao")("Slider"); <----this one allows me to set by a slider the initial position of my layer
    linear(time,t1,t2,v1,v2);
    }else value

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