FORUMS: list search recent posts

# a grids of layers converge on one point

FAQ   •   VIEW ALL
 a grids of layers converge on one point on Oct 5, 2011 at 3:46:44 pm

Hi,
I am trying to write an expression that lets layers arranged in a grid to convene on one point based on a comp's marker. It seems like this should be easy, but I'd love some help.
Thanks,
Birgit

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 5:20:13 pm

Where are the layers convening? Do they all arrive at the same time? If so, how long does it take? Or, do they all move at the same speed and arrive at different times? If so, how fast do they move? Do the layers already have position expressions to establish the grid, or did you arrange them by some other method?

Dan

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 5:29:11 pm

The convergence point is x:858, y:344, the take 5 frames and the all arrive at the same point.
The grid was made by hand, but would be happy to re-make with an expression.
Thank you.

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 5:47:24 pm

Try this:

``` target = [858,344]; frames = 5; if (thisComp.marker.numKeys >0){ t0 = thisComp.marker.key(1).time; ease(time,t0,t0+frames*thisComp.frameDuration,value,target) }else{ value } ```

Dan

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 6:09:06 pm

Thank you, you're very kind.
Birgit

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 7:02:17 pm

Hi,
I tried to adapt the code you sent for postion and apply it to rotation, but it's failing.
Each layer in the grid should rotate once at marker two: randomly between -5 degrees and +5 degrees and hold that rotation for the rest of the comp. (The comp is only 30 frames).

Birgit

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 7:12:12 pm

Try this:

``` maxR = 5; frames = 5; if (thisComp.marker.numKeys > 1){ seedRandom(index,true); target = random(-maxR,maxR); t0 = thisComp.marker.key(2).time; ease(time,t0,t0+frames*thisComp.frameDuration,value,target) }else{ value } ```

Dan

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 7:31:49 pm

Hi Dan,
Thank you so much.
Maybe I am putting your code into the wrong spot because it's not doing anything at marker 2.
I assumed I should paste into rotation expression text field?'
I am entirely learning a lot about expressions today though, so that's fabulous.
Birgit

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 7:58:22 pm

Have you tried it on multiple layers? It's a pretty subtle rotation. Zero degrees is within the random range of -5 to +5.

Dan

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 8:32:58 pm

I works beautifully, except the animation changed and now the rotation has to occur 4 frames before the postion transformation. Obviously I can't just switch the markers, so I tried re-writing the code as below, but that didn't work.
Is there something strange in the sequence?

Thanks,
Birgit

```Position: everyone converges on a target point at marker 2 target = [1296,1194]; frames = 5; if (thisComp.marker.numKeys >1){ Â t0 = thisComp.marker.key(2).time; Â ease(time,t0,t0+frames*thisComp.frameDuration,value,target) }else{ Â value } Rotation: at marker 1, everyone rotates randomly between -5 and plus 5 maxR = 5; frames = 2; if (thisComp.marker.numKeys >0){ Â seedRandom(index,true); Â target = random(-maxR,maxR); Â t0 = thisComp.marker.key(1).time; Â ease(time,t0,t0+frames*thisComp.frameDuration,value,target) }else{ Â value } ```

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 8:43:38 pm

It works for me--they all rotate at the first marker, and move at the second marker.

In what way is it not working for you?

Dan

 Re: a grids of layers converge on one pointon Oct 5, 2011 at 8:56:27 pm

Thanks for testing it.

I re-formatted the espressions and now I also get it to work.
Thank you so much for all your generous help.
Cheerio,
Birgit