Skip to main content
Legend
March 28, 2014
Answered

Getting the time of a particular keyframe

  • March 28, 2014
  • 1 reply
  • 628 views

Hi There,

I took a look at the Scripting Guide, but after a cursory search + read couldn't find the answer to my question there, so I thought I would reach out here.  How can I get the time value for a keyframe in any given property?  I know I can iterate through keys using the .numKeys value, but what is the code to use in order to  retrieve the time of the key while iterating.

Here's some pseudo code for how I'm thinking about it:

numPosKeys = lyr.transform.position.numKeys;

for (var i=1; i <= numPosKeys; i++)

{

 

     timeOfKey = {//not sure how to do this, or if it is possible};

     //do something with timeOfKey

}

Thanks for your time and help!

--Arie

This topic has been closed for replies.
Correct answer UQg

timeOfKey = lyr.transform.position.keyTime(i);

(methods to retrieve key info start with 'key', and methods to set info start with 'set' and end with 'AtKey').

Xavier.

1 reply

UQg
UQgCorrect answer
Legend
March 28, 2014

timeOfKey = lyr.transform.position.keyTime(i);

(methods to retrieve key info start with 'key', and methods to set info start with 'set' and end with 'AtKey').

Xavier.

Legend
March 28, 2014

Xavier,

Thank you for the answer.  Not sure how I missed that in the Scripting Guide PDF search, but I appreciate your quick response.

All my best,

Arie