keyValue() and keyTime()

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

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?
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

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);
	}
}

}
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

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
Post Reply