Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Get time value in seconds of keyframes in a given range

Tagged: 

  • Get time value in seconds of keyframes in a given range

    Posted by Reuben Lara on October 9, 2020 at 12:11 am

    I’m able to access all the values of a range of keyframe on a specific prperty, but how can I know when in time they are? Looking to fill the variable “keyframeTime” below. Thanks!

    var position = selection[i].property(“ADBE Transform Group”).property(“ADBE Position”);

    if(position.numKeys>0){

    for (k=1;k<position.numKeys;k++){

    var posValues = position.keyValue(k);

    var posX = posValues[0];

    var posY = posValues[1];

    var keyframeTime = ???

    }

    }

    Reuben Lara replied 5 years, 6 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 9, 2020 at 12:19 am

    It would be:

    var keyframeTime = position.keyTime(k)

    Also, if you want to examine all the keyframes, including the last one, your loop should be using:

    k <= position.numKeys

  • Stephen Dixon

    October 9, 2020 at 12:22 am

    keyframes have a time property so the line would be:

    let keyframeTime = position.key(k).time

    You can access all the properties of keyframes this way, e.g.

    let keyframeValue = position.key(k).value

    more info about keyframes in expressions here

  • Reuben Lara

    October 9, 2020 at 2:04 am

    excellent, thank you as always! your dedication to providing answers here is mesmerising, we all appreciate your commitment!

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