Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions force a var to stop updating every frame

  • force a var to stop updating every frame

    Posted by Christian Labuska on April 29, 2010 at 3:11 pm

    hi there,

    is there a way to store the current time in a variable, when a specific event happens. or in other words: can i force a var to stop updating every frame?

    in detail:
    i have a keyframed slider control (1900 … 2000)
    i have a bunch of layer which names goes like that: 1902_…/1904_../…

    with the following expression i set the opacity:

    n = thisLayer.name;
    a = n.split(“_”);
    e = a[0];
    if(e<=thisComp.layer("SLIDER").effect("SLIDER")("Slider Control")) 100; else 0;

    so far so good.

    now i want that, if the layer’s opacity jumps to 100, the layer scales from 0 to 100 which would look like this:

    ease(time, timeAtEvent, timeAtEvent+20, 0, 100)

    tried to store the time in a variable in different ways (if else/while,…) but couldn’t get the variable to stop updating when the event shown above happens.

    somebody got an idea?
    thanks a lot

    Christian Labuska replied 16 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 29, 2010 at 8:09 pm

    Variables don’t survive from one frame to the next, so your scale expression needs to figure out how long it’s been since the event. It will look something like this:

    if (transform.opacity >= 100){
    eventTime = time – thisComp.frameDuration;
    while (transform.opacity.valueAtTime(eventTime) >= 100) eventTime -= thisComp.frameDuration;
    t = time – eventTime;

    // calculate scale here based on t

    }else{
    value
    }

    This expression assumes that opacity starts out at less than 100%. If you have it set so that it’s always 100%, the expression will time out looking for the transition, so don’t apply the expression until you’ve keyframed the opacity (or modify the expression to check for that condition).

    Dan

  • Christian Labuska

    May 3, 2010 at 12:36 pm

    Thanks a lot Dan.

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