Page 1 of 1

Convert expressions to keyframes++

Posted: October 5th, 2011, 10:29 am
by i4n
I can perform any and all iterative tasks (loops, etc..), these snippets are the only thing holding me back:

*code to add/remove expression
*code to convert expressions to keyframes
*code to toggle "separate dimensions" (when dealing with xposition & yposition)

Would anyone kindly lend me a hand?

Re: Convert expressions to keyframes++

Posted: October 5th, 2011, 4:43 pm
by Paul Tuersley
These things can only be done with scripts, not expressions. I'll move this to Scripts Discussions.

To add an expression to a property you would use:

Code: Select all

property.expression = "my expression";
To remove an expression you would use:

Code: Select all

property.expression = "";
To convert an expression to keyframes you would have to loop through the time of each frame in the comp, storing the times and the values in arrays, before removing the expression and setting property.valuesAtTimes(theTimes, theValues).

To separate dimensions, I would consult the CS4 scripting changes at:
http://blogs.adobe.com/toddkopriva/2008 ... ng-ch.html

And of course, feel free to ask more questions if you get stuck.

Re: Convert expressions to keyframes++

Posted: October 6th, 2011, 12:39 pm
by i4n
Thanks, Paul. You are a constant help in these threads. As I learn more I'll contribute, as I can..