ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dividing Z Value by INDEX. Expression advice

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
victor Mayorga
Dividing Z Value by INDEX. Expression advice
on May 14, 2014 at 9:28:01 pm

I have 5 circles, with the center being the Main Circle. When I move the Main circle in the Z depth I want the other circles to be
divided by the Index
OR
Subtract by (Value * Index)

Dont know if I should go with the divide or Subtract until I see it in action.

I want to get a speaker playing effect.

I dont know how to just Subtract/divide ONLY the Z Value, I can get to work on all 3 values (x,y,z) but not just Z.


Return to posts index

George Goodman
Re: Dividing Z Value by INDEX. Expression advice
on May 15, 2014 at 1:24:21 pm

This would be division:

zlead=thisComp.layer("leaderlayer").transform.position[2];
zpos= zlead/index;
[value[0],value[1],zpos]

But I recommend doing it differently because the values aren't going to be consistent, for example, when you switch from positive to negative numbers. Instead, I recommend using a multiplier for the index and add (subtract because positive numbers are further back in z space) that. Something like this:

zlead=thisComp.layer("leaderlayer").transform.position[2];
mult=100;
zpos= zlead+index*mult;
[value[0],value[1],zpos]

Now in this case, the second layer will always be 100 behind the leader layer. If you apply the expression to the third layer in the timeline, it will always be 300 behind the leader layer. If you want to make it further, just change the number in the multiplier to be higher. Also, make sure to change the name of the 'leaderlayer' to whatever that layer is actually called.

"|_ (°_0) _|"

Sincerely,

George

http://www.vimeo.com/georgegoodman
http://www.linkedin.com/in/georgefranklingoodman


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]