ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to check for keyframes

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pravin ChotteraExpression to check for keyframes
by on May 8, 2015 at 4:32:49 pm

I want to create an expression to control the particle count of particular based on the movement of a null object.

I was wondering if there was an expression to check for the existence of a keyframe. Basically, particular would look at the null to see if there was a position keyframe (the null has baked keyframes from C4D so there is a keyframe every frame) and only emit particles if there is a keyframe.

If there an a way to write an "if keyframe exists" expression?


Return to posts index

Darby EdelenRe: Expression to check for keyframes
by on May 8, 2015 at 9:00:25 pm

You could use try/catch to access the first keyframe on the property. If there are no keyframes then it will fall back to the catch:

try{
test = position.key(0);
}
catch(err){
//No keyframes!
}


Darby Edelen


Return to posts index

Darby EdelenRe: Expression to check for keyframes
by on May 8, 2015 at 9:02:39 pm

Ack, you know you've been away too long when you're over complicating expressions, this works too:

if(position.numKeys > 0){
//keyframes!
}


Darby Edelen


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]