Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Simple scale expression for zooming in on photos

  • Simple scale expression for zooming in on photos

    Posted by Bill Russell on October 24, 2007 at 8:29 am

    Hi there – I’m looking for a quick workflow to do a gentle slow zoom in on a bunch of photos dissolving from one another. I simply need each photo to have a constant zoom start for its *layer In-Point* (not the comp start). I want to just copy the expression from one layer to the next.

    I will use the anchor point on each photo to determine the direction of the zoom. Since the photos are different sizes I need the zoom to be some sort of proportion instead of whole numbers, so that each zoom feels just like the other (rather than one being more extreme than another). I know there must be a simple expression for this, I just for the life of me can’t figure it out. Thank you, somebody!

    “THE LOST SKELETON OF CADAVRA”

    And more…

    Jonathan Bullock replied 17 years, 8 months ago 4 Members · 13 Replies
  • 13 Replies
  • Mike Clasby

    October 24, 2007 at 7:13 pm

    This seems to do what you want, a constant scale up from the inPoint over a set period of time. Set startScale, endScale and scaleUpTime to what you want. This goes on the Scale stopwatch.

    startScale = 50; // percent of Scale at start
    endScale = 100; // percent of Scale at end
    scaleUpTime = 3; // time to scale up from inPoint in seconds

    s = [endScale – startScale] /scaleUpTime;
    sx = startScale + ((time-inPoint) * s);

    ss = clamp(sx,endScale,startScale);

    [ss,ss]

    I tried to use interpolation to give you some ease choices but no luck for me. This hack is probably pretty funny to look at, I’m sure it can be simplified, but like I said it works.

  • Dan Ebberts

    October 24, 2007 at 7:34 pm

    Here’s an ease version:

    startScale = 50; // percent of Scale at start
    endScale = 100; // percent of Scale at end
    scaleUpTime = 3; // time to scale up from inPoint in seconds

    s = ease(time,inPoint,inPoint+scaleUpTime,startScale,endScale);
    [s,s]

    Dan

  • Bill Russell

    October 24, 2007 at 7:55 pm

    Thank you, Yikes Mike! That’s a big help. One big issue though, is there a way to make it relative to the initial scale size I already have set for the layer?

    (For example, before applying the expression I’ve got a particular layer set up to 23% scale, so that the 50-100% zoom dictated by the expression will be percentages of the initial property scale setting of 23%. The next layer is at 125%, so the 50-100% zoom will be a percentage of the 125% scale, etc. etc…)

  • Mike Clasby

    October 24, 2007 at 8:19 pm

    For a relative change from tan initial scale of the layer, just change the last line to:

    value + [ss,ss]

    That’s for the first expression.

    Or my and Dan’s following ones:

    value + [s,s]

    In the examples for your 23% scale, the expression would kick in at the inPoint at 23% + 50% or 73%. Sooo… maybe you want to change the first line of the expressions to:

    startScale = 0; // percent of Scale at start

    Then when you scale up it will go from your original 23% to 123% (plus 100%).

    And a layer starting out at 125% would go from 125% to 225%.

    Is that what you want? I guess I’m still a little confused.

  • Mike Clasby

    October 24, 2007 at 8:25 pm

    I was just finishing this when I saw Dan and your reply:

    OK, here’s a more straight forward way, with interpolation, it still goes on Scale:

    scale = 3; // fade in time (seconds)
    start = 50;
    end = 100;

    s = linear(time,inPoint + scale,start,end);

    [s,s]

    So if you want it to Ease a bit, change line 5 to:

    s = ease(time,inPoint + scale,start,end);

    or to have it really Ease In, change it to:

    s = easeIn(time,inPoint,inPoint + scaleUpTime,startScale,endScale);

    I think I still like the Constant Scale Up which is “linear” or the same as that original, more complicated expression in the post above.

    OK, my brain is working again, phew…

  • Dan Ebberts

    October 24, 2007 at 8:27 pm

    I think you’d just want to append this to the last line:

    *value[0]/100

    Dan

  • Bill Russell

    October 24, 2007 at 10:48 pm

    Dan, thank you, that’s perfect, it’s doing exactly what I need when I set startScale at 100. “Value”, now I understand what that means, a little edification. What is “value[0]” — or otherwise, is there a glossary or something that explains syntax and variables in a way a calcified brain like mine could understand?

    Again, thank you.

    “THE LOST SKELETON OF CADAVRA”

    And more…

  • Bill Russell

    October 24, 2007 at 11:01 pm

    Hi Mike — multiplying the result by value[0]/100 seems to be the answer for getting _proportional_ zoom changes based on the intitial property value, whereas adding value to it seemed to result in different zoom speeds depending on the size of the property value. I think this is the reason: For instance, 23% + 50 is a lot more extreme than 125% + 50. That said, I HUGELY appreciate both the response and especially how to do the ease/ramps you describe!!!, that is going to really come in handly.

    Enormously grateful – B

    “THE LOST SKELETON OF CADAVRA”

    And more…

  • Bill Russell

    October 24, 2007 at 11:15 pm

    Is there such a thing as “global” variables? Like, if I want to change the “endScale” value for all of the layers at once, instead of editing the expressions for each layer, is there place I can define and call and “endScale” variable globally? Thanks!

  • Dan Ebberts

    October 24, 2007 at 11:18 pm

    For multi-dimensional properties like position or scale, value is a JavaScript array representing the current keyframed value. value[0] is the x component and value[1] is the y component. For a one-dimensional property like opacity, value is a scalar and you don’t need to use the brackets [].

    Dan

Page 1 of 2

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