ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# scale & move chain of solids with lowest one anchored

FAQ   •   VIEW ALL
 scale & move chain of solids with lowest one anchored on Aug 21, 2009 at 2:43:48 am

I'm trying to come up with a set of expressions (one for scale, one for position) which I can add to a stack of solid squares so that when I scale or move the top-most square, all of the squares below it will follow suit, only offset in time a bit so they're not all moving and scaling at the same time (kind of like the Echo effect).

But there's one catchâ€¦ I want the bottom layer to stay anchored in place. This means that each layer will have to move and scale a bit less as you move down the layer order.

I used bits of Jerzy Drozda's snake expression to get me pretty close, but I can't seem to work out the math to make that bottom layer remain stationary.

Can anyone point me in the right direction?

 Re: scale & move chain of solids with lowest one anchoredon Aug 21, 2009 at 11:25:42 am

If I understand correctly, you can do this:

have the "first" layer on top (the one you keyframe)
have the "last" layer on the bottom don't keyframe it, so it stays stationary

inbetween sandwich layers with these expressions:
(no parenting)

position:
``` first=thisComp.layer("first"); last=thisComp.layer("last"); i=index-first.index+1; lag=0.2; linear(i,first.index,last.index,first.position.valueAtTime(time-lag*i),last.position); ```

and very similarly: for scale
``` first=thisComp.layer("first"); last=thisComp.layer("last"); i=index-first.index+1; lag=0.2; linear(i,first.index,last.index,first.scale.valueAtTime(time-lag*i),last.scale); ```

 Re: scale & move chain of solids with lowest one anchoredon Aug 21, 2009 at 5:32:00 pm

Perfect! It's genius, thank you so much!

 Re: scale & move chain of solids with lowest one anchoredon Dec 13, 2016 at 2:13:29 pm

Hi Filip,

I've discovered your expression some years later and I believe this is getting me closer to my solution for a character rig that I'm creating.

When I implemented this expression for the position on several solid layers, I noticed that when I moved the "first" layer all the in between layers were moving at the same amount/rate.

Is there a way to alter this so that the layers that are closer to the bottom move at a slower rate than the ones towards the top?

Essentially, I'm creating a squash and stretch rig. My first implementation utilized several null points that were parented to a master null. The parent was located at the bottom of the character, sort of like a global position controller. The parent null was then scaled non uniformly, like 64,140 or 140, 64, which caused the children to move appropriately. When I did this, I noticed that the children closer to the bottom where the parent was located was moved at a slightly lower rate than the ones towards the top of the character.

This works out fine, but I wanted to improve the rig, but implementing the same look without having to parent the children and using the scale to move them.

Essentially I'd like to have a controller that I can move up and down, that would cause the other "non parented" children to move appropriately.

I'm familiar with working with expressions, but unfortunately I'm just an animator, with no programming skills, so I couldn't begin to figure out the math equation to implement this.

I hope I was able to clearly explain what I'm looking for.