ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control Z Position of multiple Layers with one controller

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marcel Schobel
Control Z Position of multiple Layers with one controller
on Jun 9, 2020 at 7:58:28 am

Hey Guys and Gals...
i try to do the following:

i have a grid of letters (all 3D layers) ..evenly distributed all over the screen... z Position is 0 ...
now i would love to have an expression that allows me to change the z Position for all layers randomly ... so when i change one value (in a slider maybe) the letters move in Z ...without jumping every frame ...
i have come to a dead end with my limited expression knowledge ...
i would appreciate any help
m.


Return to posts index

Robert Müller
Re: Control Z Position of multiple Layers with one controller
on Jun 9, 2020 at 10:36:15 am

Hey Marcel, this should do what you are looking for:

fac=thisComp.layer("ctrl").effect("factor")(1) //slider on a Null layer
x=value[0];
y=value[1];
rdmMin=-100; //Min random value
rdmMax=100; //Max random value
rdmSeed=123456 //random seed
seedRandom(rdmSeed, timeless = true); //timeless is true, so the value doesnt update every frame
rdmVal=random(rdmMin, rdmMax);
z=rdmVal*fac;
[x,y,z]

Now when you animate your slider on the control layer from 0 to 1 the layers will start moving up to their random z position. You can increase this if you go beyond 1.
If this is not random enough you could always factor each layers index into the seed, so you would have a individual seed for every layer. If you want a more natural random distribution you could use "gaussRandom()" instead of "random()"


Return to posts index

Marcel Schobel
Re: Control Z Position of multiple Layers with one controller
on Jun 9, 2020 at 11:16:43 am

Thank you Sir !
this does the trick. I am pretty solid at After Effects in all areas EXCEPT for Expressions. I wish i could wrap my head around that. I can even understand/interpret your expression (kind of) BUT i just cannot come up with one myself ... i will try to learn in the next couple of weeks ...been neglecting expressions for way too long.
thanks again for your time and kindness
regards


Return to posts index

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