Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Checkbox Controlled Opacity Easing

  • Checkbox Controlled Opacity Easing

    Posted by Michael Martin on September 22, 2014 at 5:57 pm

    Long time lurker-first time poster. I really need some help here…

    have a client project with 19 Videos. Each video is highlighting 3 separate qualities in their product. We have called them:

    – F&F
    – MCL
    – IE

    When one or more of these attributes is displayed on screen, a text changes from a 0% opacity to 100%. They are linked to a Opacity controller for each individual piece of text and each controller is linked to a MASTER CONTROLLER with 3 check boxes. The goal here is to set only three different keyframes… keep things tidy…. 19 freakin’ videos… HA! Hopefully this is painted a decent picture for you guys.

    MY ISSUE: All of the “mechanism” is working perfectly. The keyframes on the check boxes all work and control things properly BUT i would like to EASE in and out of the opacity change, rather than the “nature” of a check box being on or off… I am totally at a loss on how to make this happen.

    Let me know if I can supply any additional information to help…

    if(thisComp.layer("Master Controller").effect("F&F")("Checkbox")==1) 100 else 0;

    Craig Sinclair replied 8 years ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 22, 2014 at 7:28 pm

    Try this:


    fadeTime = .5;
    cb = thisComp.layer("Master Controller").effect("F&F")("Checkbox");
    if (cb.numKeys > 0){
    n = cb.nearestKey(time).index;
    if (cb.key(n).time > time) n--;
    if (n >0){
    t = time - cb.key(n).time;
    if (cb.key(n).value > 0)
    ease(t,0,fadeTime,0,100)
    else
    ease(t,0,fadeTime,100,0);
    }else{
    0
    }
    }else
    if (cb.value > 0) 100 else 0

    It does assume that the first checkbox keyframe is an on keyframe and that they alternate thereafter.

    Dan

  • Michael Martin

    September 22, 2014 at 7:44 pm

    THIS TOTALLY WORKS! Thanks sooooo much. Lifesaver!

    Is there a way to alter the code so it doesn’t assume the first keyframe is “ON”?

  • Dan Ebberts

    September 22, 2014 at 7:54 pm

    This should let the first keyframe be on or off, but they still need to alternate:


    fadeTime = .5;
    cb = thisComp.layer("Master Controller").effect("F&F")("Checkbox");
    if (cb.numKeys > 0){
    n = cb.nearestKey(time).index;
    if (cb.key(n).time > time) n--;
    if (n >0){
    t = time - cb.key(n).time;
    if (cb.key(n).value > 0)
    ease(t,0,fadeTime,0,100)
    else
    ease(t,0,fadeTime,100,0);
    }else{
    if (cb.key(1).value > 0) 0 else 100;
    }
    }else
    if (cb.value > 0) 100 else 0

    Dan

  • Michael Martin

    September 22, 2014 at 7:56 pm

    Seriously, thanks so much. You just saved me about 6 hours of setting keyframes.

  • Craig Sinclair

    September 27, 2018 at 1:19 pm

    You’re a legend Dan.

    You’re so helpful on this forum. Literally every I click on for help, you’re there with the answer.

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