Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to trigger based on comp duration

  • Expression to trigger based on comp duration

    Posted by John Pritchett on July 1, 2019 at 3:02 am

    Legends. I need a simple 2 keyframe position animation to start based on the comp duration. ie animation runs 1 sec, so I need to determine the comp duration, then subtract 1 sec so the animation always finishes at comp end..
    Any help appreciated!!

    John Pritchett replied 6 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    July 1, 2019 at 6:17 am

    It’ll probably be something like this:

    t1 = key(1).time;
    t2 = key(2).time;
    d = t2-t1;
    t = linear(time,thisComp.duration-d,thisComp.duration,t1,t2);
    valueAtTime(t)

    Dan

  • John Pritchett

    July 1, 2019 at 8:05 am

    Dan, you are truly a master.
    Works almost perfectly!
    The animation is not finishing completely 1 frame from the end of the comp..
    I added a thisComp minus .1sec, and it works fine.

    Thank you.

    t1 = key(1).time;
    t2 = key(2).time;
    d = t2-t1;
    t = linear(time,thisComp.duration-d,thisComp.duration-.1,t1,t2);
    valueAtTime(t)

  • John Pritchett

    July 1, 2019 at 8:06 am

    t1 = key(1).time;
    t2 = key(2).time;
    d = t2-t1;
    t = linear(time,thisComp.duration-d,thisComp.duration-.1,t1,t2);
    valueAtTime(t)

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