Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Global vars / instances

  • Global vars / instances

    Posted by Dino Muhic on April 4, 2009 at 1:29 am

    Hi guys

    Ok …this is somehow hard to describe.

    I have many layers (50+) in 3D space all doing the same thing but at different times (getting scaled up from 13% to 26% in a time of 15 frames).

    Problem is that the values might get changed and changing it for all layers by hand takes ages.

    So my question is, if there’s is a way to make the scaling values somehow like globar variables like s1= 13, s2=26 so that every layer is taking these values for scaling?

    The layers are not lined up in time! If they were I could easily make a slider and keyframe it like I want and then pickwhip it but they are not lined up. The scaling appeares for each layer at a different time, though the animation (scale up from s1 to s2 in 15 frames) is the same for all of them.

    Is there a way to do this? I really hope so since it could save me a ton of time later, because they are not just scaling, they are moving and rotating, too! Again same animation but different times!

    Here’s a screenshot of my timeline. There you can see how all blue layers have the same chunk of keyframes at a different point

    Globalvars

    Thanks alot!

    Dino Muhic – Media Producer
    VFX – Motion Graphics – Web-Design – Or just ART
    http://www.dinomuhic.com

    Dino Muhic replied 17 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 4, 2009 at 2:48 am

    Try this. Add a null named “control” and apply 2 slider controls to it named “s1” and “s2”.

    Then add this expression to the scale property of one of your 3D layers:

    if (numKeys > 1){
    s1 = thisComp.layer(“control”).effect(“s1”)(“Slider”);
    s2 = thisComp.layer(“control”).effect(“s2”)(“Slider”);
    linear(time,key(1).time,key(2).time,[s1,s1,s1],[s2,s2,s2])
    }else{
    value
    }

    Then select that layer’s scale property and do Edit > Copy Expression Only. Then select all the other layers and Edit > Paste.

    Then you should be able to adjust all the layers at once with the sliders, but keep the timing of each layer’s keyframes.

    Dan

  • Dino Muhic

    April 4, 2009 at 12:24 pm

    Wow, thanks alot Dan!

    I’ll try it as soon as possible.

    I looked over the code to find out how you did it, because I want to understand it….

    linear(time,key(1).time,key(2).time,[s1,s1,s1],[s2,s2,s2])

    so key(1) is the first keyframe applied on the layer and key(2) the second?
    So that’s how I can access specific keyframes on a layer?
    What does the linear stand for? Keyframe interpolation?

    Thanks alot again

    Dino Muhic – Media Producer
    VFX – Motion Graphics – Web-Design – Or just ART
    http://www.dinomuhic.com

  • Dan Ebberts

    April 4, 2009 at 3:42 pm

    > so key(1) is the first keyframe applied on the layer and key(2) the second?

    Yes.

    > So that’s how I can access specific keyframes on a layer?

    Yes, that’s one way. Another is nearestKey.

    > What does the linear stand for? Keyframe interpolation?

    linear() is an interpolation method. Others are ease(), easeIn(), and easeOut(). They can interoplate a range of values (in this case between [s1,s1,s1] and [s2,s2,s2]) based on two other numbers (in this case the time of keyframe 1 and the time of keyframe 2). The numbers needn’t be associated with keyframes though.

    Dan

  • Dino Muhic

    April 4, 2009 at 3:48 pm

    Thanks Dan, it worked well! I love AE and I love this forum! 🙂

    Dino Muhic – Media Producer
    VFX – Motion Graphics – Web-Design – Or just ART
    http://www.dinomuhic.com

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