Page 1 of 1

keyValue() and keyTime()

Posted: June 1st, 2005, 7:22 am
by byronnash
Why do keyValue() and keyTime() both return the time of the key? Either I'm reading the Scripting Guide wrong or there's an error in it. Look at page 131 and 141. They both say:

Returns
Floating-point value; the time at which the keyframe or marker occurs.


I need to get a value from a keyframe and change it. I was trying use keyValue to retrieve the value and then use setValueAtKey() to store it again on the key. I'm getting problems. Is there a better workflow?

Posted: June 1st, 2005, 10:03 am
by byronnash
I think the manual must be wrong. I was able to get this to work.

Code: Select all

{
var proj = app.project; 
var myComp = proj.item(1); 
var myLayer = myComp.layer(1);
var myprop = myLayer.scale;

if (myprop.isTimeVarying != false){
	for (var i = 1; i <= myprop.numKeys; i++){
		var curVal = myprop.keyValue(i);

		curVal = curVal * .75;

		writeLn(curVal[0] + " , " + curVal[1]);

		myprop.setValueAtKey(i,curVal);
	}
}

}

Posted: June 1st, 2005, 11:57 am
by redefinery
byronnash wrote:I think the manual must be wrong.
Yeah, it probably is. There are a few places in the doc where info was copied/pasted from other sections. A few months back I did a quick edit pass of the doc and sent my corrections to the AE team.

Jeff