Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger a animation using a checkbox

  • Pedro Amaral

    July 23, 2018 at 2:12 pm

    Hey Dan,

    I have 2 separate animations, one that triggers when the checkbox is On and another one for when the checkbox is Off.
    I’m using your expression to trigger one animation when the checkbox is On, which works perfectly:

    n = 0;
    p = comp(“Controller”).layer(“Death”).effect(“Player 01”)(“Checkbox”);
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n–;
    }
    if (n > 0 && p.key(n).value)
    time – p.key(n).time
    else
    0

    However, I’m trying to figure out how to get a second animation to trigger when the checkbox is turned OFF.

    I’ve tried changing things around in the expression but haven’t been able to figure out what part of the expression is dictating the True/False of the Checkbox.

    Any ideas?

    Thanks in advance!

  • Dan Ebberts

    July 23, 2018 at 3:34 pm

    Try it this way:


    n = 0;
    p = comp("Controller").layer("Death").effect("Player 01")("Checkbox");
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n--;
    }
    if (n > 0 && ! p.key(n).value)
    time - p.key(n).time
    else
    0

    Dan

Page 2 of 2

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