FORUMS: list search recent posts

# Splitting and Distributing Layers in 3D space Via Slider Randomly

FAQ   •   VIEW ALL
 Splitting and Distributing Layers in 3D space Via Slider Randomly on Aug 4, 2015 at 2:08:45 pm

I have a really cool expression that creates the illusion that an image looks normal based on the camera position.. but once the Camera rotates and moves, you can see all the layers are distributed randomly in 3D Space. The Expression adjusts the Scale of each layer to make it appear normal size based on the Camera's Position. I create an Expression slider for each layer and set the parameter to 100. Smaller than 100 moves towards the Camera, less than 100 moves away from the Camera.. (Expressions Below)

My Question:
Instead of adjusting a random position for each one (which could be hundreds).. is there are way to attach each layers expression slider to one main Expression Slider that feeds a Random Distribution for each layer. My goal is to quickly readjust the Z distribution if its not quite right.

```1. Created an Expression Slider on each Layer and called it zControl and set the initial value to 100 2. Pasted this on Position Value on each layer: (Z space based on Camera's Position when created) cameraPos = [thisComp.width/2,thisComp.height/2,-1866.6667]; zControl = effect("zControl")("Slider") v = (value - cameraPos)*zControl/100 + cameraPos; 3. Pasted on Scale: zControl = effect("zControl")("Slider") value*zControl/100 ```

 Re: Splitting and Distributing Layers in 3D space Via Slider Randomlyon Aug 4, 2015 at 2:22:00 pm

To Follow Up.. I'd love to Cap the Values to Randomize within (-20 and 180). Something like this:

seedRandom(index,true);
zVal = thisLayer.transform.position[2]+random(-20, 180);
[zVal]