Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Rigging Up a 2D Carousel, as items move closer to the camera or a certain position, the scale and well as the opacity increases

  • Rigging Up a 2D Carousel, as items move closer to the camera or a certain position, the scale and well as the opacity increases

    Posted by Ryan Black on November 16, 2015 at 6:55 pm

    Hey guys!

    I’m looking to make a 2D Carousel that scrolls across the screen left to right. I can rig them to move the way I wasn’t them to, but I’d really prefer to not go in and animate each layer (since there’ll be a lot of the icons). I’m curious as to how I can make the items scale up and down as they come closer to the screen, as well as lower the opacity as they get farther away/smaller.

    Example 1:

    Example 2:

    These images are kind of a sample of the thing I’m trying to do. I’m looking to make the scale a lot more drastic. Maybe so that the items are almost touching, and they would seem to interact with each other. So when one grows to 100%, the other ones are like 10%. (Like in example 2).

    Any help with this would be greatly appreciated!

    Ryan Black replied 10 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    November 17, 2015 at 9:37 am

    You want to tie the scale, position and opacity to the x position of the layer/precomp with expressions.

    The real trick is keeping the distances between the objects as one scales up, which is why you have to create an offset to keep the other layers away from the center until they come close enough to it to start to scale.

    I did a comp where the shape layer was 100 x 100 pixels and used these expressions.

    For scale:

    location = transform.position;
    distance = Math.abs(location[0]-thisComp.width/2);
    if (distance<1){distance=1};
    layer_scale = 100;
    if (distance<500 && distance>100){layer_scale = 100+(500-distance)*(9/4)}; // scale goes from 100 to 1000 in 400 pixels
    if (distance<=100){layer_scale=1000};
    [layer_scale,layer_scale]

    for position:

    x_location = index * 150 + time *100;
    y_location = transform.position[1];
    distance = x_location-thisComp.width/2;
    if (distance<0){sign=-1}else{sign=1};
    distance = Math.abs(distance);
    offset = 400;
    if (distance<100 && distance>50){offset = 400-(100-distance)*8};//offset goes from 400 to 0 in 50 pixels
    if (distance<=50){offset = 0};
    [x_location+offset*sign, y_location]

    for opacity:

    50+transform.scale[0]/20 // opacity 55 when scale is 100%, 100 when scale is 1000%

    I used time and layer index for the horizontal position, so it doesn’t have to be animated by hand. (Add an initial offset to left for the x_location to fit a longer row of items.)

    When you copy the solid, other layers are automatically offset 150 pixels to the right, so you can duplicate this as many times as needed.

    To make this flexible with sliders, layer sizes etc. would be significantly more work, so I’ll leave the modifications up to you. The basics are there.

  • Ryan Black

    November 18, 2015 at 4:20 pm

    This is fantastic! Thank you so much!

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