Activity › Forums › Adobe After Effects Expressions › Trigger a animation using a checkbox
-
Trigger a animation using a checkbox
Dan Ebbertsreplied 7 years, 9 months ago 6 Members · 12 Replies
-
Pedro Amaral
July 23, 2018 at 2:12 pmHey 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
0However, 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 pmTry 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
Reply to this Discussion! Login or Sign Up