Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions hold an expression at it’s last value

  • hold an expression at it’s last value

    Posted by Roei Tzoref on December 5, 2016 at 10:50 am

    hey all you expression wizards ☺

    I wish to figure out how to stop an expression at it’s ending value: say I have a rotation of a layer set to time*30 and I want to create a checkbox control to hold it (and continue) every time I click it.

    so I have this:
    if (effect(“Checkbox Control”)(“Checkbox”)==1) time*30 else ?;

    what should I put after the else the makes it “stop at current time” so I can toggle this time expression on and off and keep my current position when I freeze it?

    thank you

    Roei Tzoref
    After Effects Artist & Instructor
    ♫ Ae Blues Tutorials

    Roei Tzoref replied 9 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 5, 2016 at 5:18 pm

    Something like this, probably:


    chkBx = effect("Checkbox Control")("Checkbox");
    n = 0;
    if (chkBx.numKeys > 0){
    n = chkBx.nearestKey(time).index;
    if (chkBx.key(n).time > time) n--;
    }
    t = 0;
    curTime = time;
    if (n > 0){
    for (i = n; i > 0; i--){
    if (chkBx.key(i).value > 0){
    t += (curTime - chkBx.key(i).time);
    }
    curTime = chkBx.key(i).time;
    }
    if ((curTime > 0) && (chkBx.key(1).value > 0)) t += curTime;
    }else{
    if (chkBx.value > 0) t = time;
    }
    t*30

    Dan

  • Roei Tzoref

    December 5, 2016 at 8:52 pm

    Thank you Dan. it works and I will keep it near. I was thinking this could be much simpler so I could tweak it to other manipulations as well – for example wiggle. here I was thinking that instead of my “?” there’s only a few letters of codes and that’s it. I can’t really get my head around this but blindly copy pasting it. guess this was heavy stuff.

    Roei Tzoref
    After Effects Artist & Instructor
    ♫ Ae Blues Tutorials

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