Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions checkbox hold value expression

  • checkbox hold value expression

    Posted by Dan Wiese on April 12, 2011 at 12:31 am

    I have a slider that’s controlling the X position of a bunch of layers that are all linked together. Is there a way with a checkbox to be able to override the slider to make it freeze/unfreeze when checked or unchecked and continue along with the animation. It’s more or less a hold keyframe but I’d like to be able to connect it to something like a loopOut(“offset”); so that it would resume it’s current rate of speed automatically. When checked the value would freeze and hold and when unchecked it would resume on its way.

    Thanks in advance.

    Dan

    Dan Ebberts
    replied 15 years ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    April 12, 2011 at 5:43 am

    I think the answer is yes, but I don’t think you can do it with loopOut(“offset”) directly. You’d have to create your own version of loopOut() so that you have access to the loop timing (which would be a bit of work) and drive that with a checkbox accumulator that calculates the elapsed time based on how long the checkbox has been in the “on” state in the past. Not hard conceptually, but time consuming to get it just right. Maybe someone here has time to tackle it.

    Dan

  • Dan Wiese

    April 12, 2011 at 5:12 pm

    Say I took the slider, duplicated it placed it on a new null, still used my loop offset but baked it out to keyframes with convert expression to keyframes that way I’d have a pre calculated value, does that make what I’m trying to do more possible?

    Thanks,

    Dan

  • Dan Ebberts

    April 12, 2011 at 6:51 pm

    Absolutely. Now you just need the checkbox accumulator, which should look something like this:


    p = effect("Checkbox Control")("Checkbox");
    t = 0;
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n--;
    if (n > 0)
    for (i = 1; i <= n; i++)
    if (p.key(i).value == true)
    if (i < n)
    t += p.key(i+1).time - p.key(i).time
    else
    t += time - p.key(i).time;
    }
    valueAtTime(t)

    Dan

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