Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression to check for keyframes

  • Expression to check for keyframes

    Posted by Pravin Chottera on May 8, 2015 at 4:32 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?

    Darby Edelen replied 10 years, 12 months ago 2 Members · 2 Replies
  • 2 Replies
  • Darby Edelen

    May 8, 2015 at 9:00 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

  • Darby Edelen

    May 8, 2015 at 9:02 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy