FORUMS: list search recent posts

# Video Wall With Random Z Placement Transition

FAQ   •   VIEW ALL
 Video Wall With Random Z Placement Transition on Apr 11, 2015 at 9:07:29 pm

Hey guys, just started to get into expression more now. Amazing how powerful they can be :)

I've been using this code below to create a video all of over 100 comps, each containing images / video. I can't remember where a found the code, but hat's off to the person who made it, it works very well and did exactly what I needed.

numRows = 12;
numCols = 12;
row = Math.floor((index - 1)/numCols);
col = (index - 1)%numCols;
xScale = scale[0]/100;
yScale = scale[1]/100;
x = col*width*xScale + width*xScale/2;
y = row*height*yScale + height*yScale/2;
xOffset = (this_comp.width - numCols*width*xScale)/2;
yOffset = (this_comp.height - numRows*height*yScale)/2;
[x,y] + [xOffset,yOffset]

Originally I was going to animate the camera, but now what I would like to do is have each image fly in through z space randomly, eventually making up the whole wall. I had a go myself and managed to get something kind of working, but only if I split up x, y, z coordinates individually. Each image flies in one after the other based on the index number against the current time in the sequence. At the moment they are also not stopping once they get to 0, they just keep on going into infinity.

zdist = -1000
zspeed = 10
if (index <= time){(((time - index)*zspeed) + zdist)}else{zdist}

My main trouble is that I need two if's, one for the index number equalling the time, and one to stop the object once it gets to 0 in z space. Also if the x, y, z positions are grouped together like the first expression I can't get this to work, I can set an object value to an if function to recall later.

Ideally I would like to have control over the starting position (-1000), the end position (0), the speed (the rate at which they each fly in). It would also be good to control the over all speed of the whole animation, but I could maybe do this by dividing each object index number and they comparing to time, or time-sing time and then comparing to the index number.

Hope that makes sense? Have spent hours on this today and not got very far :( if anyone can point me in the right direction, that would be amazing!!! Many thanks.

```numRows = 12; numCols = 12; row = Math.floor((index - 1)/numCols); col = (index - 1)%numCols; xScale = scale[0]/100; yScale = scale[1]/100; x = col*width*xScale + width*xScale/2; y = row*height*yScale + height*yScale/2; xOffset = (this_comp.width - numCols*width*xScale)/2; yOffset = (this_comp.height - numRows*height*yScale)/2; [x,y] + [xOffset,yOffset] zdist = -1000 zspeed = 10 if (index &lt;= time){(((time - index)*zspeed) + zdist)}else{zdist}```