Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions triggering keyframes with an expression

  • triggering keyframes with an expression

    Posted by Ken Ackerman on August 6, 2010 at 6:54 pm

    Hello.

    I am trying to trigger an expression (or simply keyframes) using a slider.

    I am making a graphic sliding scale consisting of a line of squares. I want to be able to increase a slider, and have each square animate when it’s respective number is passed on the slider.
    So far, I’ve got them wobbling using an expression I got from Dan Ebberts at Motion Script.
    But now I want to fade out a color overlay layer style’s opacity when the square is triggered.
    Basically I need an expression that says:

    when SliderValue > X turn ColorOverlay to 100% and then fade out slowly over time.
    If SliderValue < X turn ColorOverlay to 0

    Any thoughts? Thank you

    Ken Ackerman replied 16 years ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 6, 2010 at 11:24 pm

    You were a little sparse on the details, but it’s going to look something like this:


    sliderVal = thisComp.layer("controls").effect("Slider Control")("Slider");
    triggerVal = 50;
    fadeTime = 1.5;
    above = false;
    frame = timeToFrames();
    while (true){
    t = frame * thisComp.frameDuration;
    if (above){
    if (triggerVal > sliderVal.valueAtTime(t)){
    frame++;
    break;
    }
    }else if (triggerVal <= sliderVal.valueAtTime(t)){
    above = true;
    }
    if (frame == 0){
    break;
    }
    frame--;
    }
    if (! above)
    value
    else
    linear(time - t,0,fadeTime,100,0);

    Dan

  • Ken Ackerman

    August 6, 2010 at 11:54 pm

    Thanks Dan, that was exactly what I was looking for. I really appreciate the help.

  • Ken Ackerman

    August 7, 2010 at 12:46 am

    Hi Dan,

    That is actually exactly what I was asking for, but I’m now realizing that it is not right for what I’m doing. I tried to figure out how to change the expression to match my needs but I’m running up against a wall.

    Basically I’m creating a slider that consists of a row of small whites cubes. As I increase my slider control the cubes individually wobble, and turn orange. The decay of the wobble is perfect, but I’m now realizing that as long as the slider value is up the cubes need to stay full orange, once the slider falls below their number, they need to fade back out to white.

    So I think the expression needs to tell the opacity to change to 100% once the sliderVal >= triggerVal, and remain at that value until the sliderVal falls below the trigger val, at which point the opacity should begin to fade to zero.

    I hope this is enough information. And again, thank you so much for your expertise — your website is the reason I am brave enough to even try using expressions.

    Ken

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