Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Relational scaling (or The Wave)

  • Relational scaling (or The Wave)

    Posted by Brendan Mccullough on October 1, 2008 at 6:07 pm

    Hello All,

    To become better at using expressions, I attempt to recreate things I’ve seen in commercials and television shows. Recently, I came across an ad for a sports drink where I saw something interesting.

    A row of bottles is shown (about 15), and what I call “the wave” (think athletic stadium) occurs. In the span of about 3 seconds, we see the bottles, all equal in scale in a row. Then (quickly) the first bottle scales to about 170%, and then back down to 100%. As it scales, the bottles following it (to its’ right) scale in relation to it, that is, the one immediately to the right scales to roughly 90% of the current scale of the first bottle, the one to the right of that one scales to roughly 90% of the bottle to its’ left (the 2nd bottle) and roughly 80% of the first bottle, and so on down the line. As the second bottle scales in relation to the first in the row, it eventually grows beyond to reach the target size (say about 170%), and on down the line (back and forth and back and forth), creating a very neat scaling wave effect.

    However, it’s not just the scaling. The bottles never overlap, and may shift left or right slightly to accommodate the scaling of the surrounding bottles. The total width of the row really didn’t change at all (let’s pretend we started with our row evenly distributed edge-to-edge in safe-title and we maintain that distribution). The bottles are each anchored at their base.

    I started playing with expressions to get an object to maintain the same distance from an object next to it, regardless of that objects scale, and had success, but I started getting an ice cream headache when I was trying to figure out how to make the scales dependent on each other, maintain position, and do all the other things I just described, while linking them to some nice little slider-or-similar control that would allow me to control the wave.

    This isn’t for a project I’m working on at the moment. I simply thought it was an interesting effect that could be applied across a variety of looks and transform properties.

    If I make any headway, I’ll post it.

    Brendan Mccullough replied 17 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 1, 2008 at 8:23 pm

    Play around with this. It should spread the layers out within the boundaries of title safe:

    totalW = thisComp.width*.8;
    startX = thisComp.width*.1;
    N = thisComp.numLayers

    accumWidth = 0;

    for (i =1; i <= N; i++){ L = thisComp.layer(i); accumWidth += L.width*L.scale[0]/100; } if (N == 1) gap = 0 else gap = (totalW - accumWidth)/(N - 1); accumX = startX; for (i = 1; i <= N; i++){ if ( i != 1) accumX += gap; if (i == index) break; L = thisComp.layer(i); accumX += L.width*L.scale[0]/100; } accumX += width*scale[0]/200; [accumX,value[1]] Dan

  • Brendan Mccullough

    October 1, 2008 at 9:08 pm

    Thanks for getting back to me so quickly! I tried it out immediately, and once I start toying with sequenced scaling using an expression control, I think this is going to do exactly what I’m thinking about (I’ve been searching in vain trying to find the original example).

    I’m still breaking down the code you posted, so I may have a few questions as I dissect it. Thank you very much, Dan.

    –Brendan

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