Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions 2nd part of conditional statement not working

  • 2nd part of conditional statement not working

  • David Cabestany

    September 20, 2022 at 2:27 pm

    I’m trying to use the keyframes for position to drive other parameters, rotation in this case, but only for part of the position animation.
    The first part, from kf1 to kf2 works fine, but when the object moves to kf3 it is also rotating, which I do not want.

    I added a part of the condition that states that if the kf is bigger than 2 then the value should be 0, but as I see the object moving from kf2 to kf3 I see the rotation parameter still following the linear expression instead of defaulting to 0 as I want it to happen.

    Any help is greatly appreciated.




    n = 0;

    if (marker.numKeys > 0){

    n = marker.nearestKey(time).index;

    if (marker.key(n).time > time) n–};











  • Dan Ebberts

    September 20, 2022 at 4:30 pm

    A couple of things–you seem to be mixing the use of markers and position keyframes–you didn’t mention that in your description, and it’s not clear how that should work. Also, you don’t account for the condition where n is exactly 2, so that could be a problem.

  • David Cabestany

    September 20, 2022 at 4:40 pm

    Thanks Dan, the marker/keyframe mixup is definitely unintended, I only want to use keyframes for this.

    Basically a linear animation between keyframes 1 and 2 and then 0 after that.

  • Dan Ebberts

    September 20, 2022 at 6:39 pm

    Maybe like this:

    t1 = p.key(1).time;
    t2 = p.key(2).time;
Viewing 1 - 4 of 4 posts

Log in to reply.

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