Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Limiting Expressions Duration

  • Limiting Expressions Duration

    Posted by Cameron Crook on November 11, 2010 at 7:59 pm

    I am working on a project which involves shapes that consecutively reveal themselves by scaling out however, i need an expression that will allow the first shape to scale from 0-10, but when it reaches 100 it stops and then the next shape goes and so on. I don’t want to keyframe each individually, because I have a lot of shape layers. Any help is appreciated.

    Kevin Camp replied 15 years, 6 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    November 12, 2010 at 12:13 am

    I’m not sure exactly what you mean, but play around with this scale expression. The first line defines how long it takes each layer to scale up.

    scaleTime = 1;

    t = (index-1)*scaleTime;
    ease(time,t,t+scaleTime,[0,0],[100,100])

    Dan

  • Cameron Crook

    November 12, 2010 at 9:11 pm

    Basically, I have a bunch of layers that I want to scale to 100% 1 after another. I would normally keyframe each’s scale, however, it would be extremely tedious plus i would have to change all the keyframes again if I wanted to change how long it would take for them to scale up. I attempted to do this using if statements but for some reason they didn’t work, the objects scale continued to increase without stopping.

    if(transform.scale==100){100}
    else{time*25}

  • Dan Ebberts

    November 12, 2010 at 9:36 pm

    I think the reason your expression doesn’t work the way you want it to is that any time an expression references the value of the property hosting the expression, what you get back is the pre-expression (ie, keyframed) value, not the value previously calculated by the expression. So trying to get an expression to stop by checking the value of the property doesn’t work.

    I think this change to the expression I cooked up before is pretty close to what you’re after, depending on how your comp is structured (mainly where the scaling layers are in the layer stack):

    scaleTime = 4;
    t = (index-1)*scaleTime;
    ease(time,t,t+scaleTime,[0,0],[100,100])

    Dan

  • Kevin Camp

    November 12, 2010 at 9:43 pm

    i think you may want to use a valueAtTime expression… that way you can have one layer with the keyframes and the others will just use valueAtTime to reference that animation, but with a time offset.

    i assume that ‘newer’ layers will be layered on top/above the first layer to scale up… if so something like this may work for all the other layers:

    target=thisComp.layer("ControlLayer");
    lastKey=target.scale.key(target.scale.numKeys);
    target.scale.valueAtTime(time-(lastKey.time*(target.index-index)));

    the ‘target’ layer would be your first layer, the one with the scale keyframes. each layer above it with that expression will scale up sequentially… ie the second layer to scale will be the layer directly above the target,the next layer to scale will be one above that, etc…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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