Activity › Forums › Adobe After Effects Expressions › a grids of layers converge on one point
-
a grids of layers converge on one point
Posted by Birgit Rathsmann on October 5, 2011 at 3:46 pmHi,
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,
BirgitBirgit Rathsmann replied 14 years, 7 months ago 2 Members · 11 Replies -
11 Replies
-
Dan Ebberts
October 5, 2011 at 5:20 pmWhere 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
-
Birgit Rathsmann
October 5, 2011 at 5:29 pmThe 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. -
Dan Ebberts
October 5, 2011 at 5:47 pmTry 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
-
Birgit Rathsmann
October 5, 2011 at 7:02 pmHi,
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).Thanks for all your help.
Birgit -
Dan Ebberts
October 5, 2011 at 7:12 pmTry 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
-
Birgit Rathsmann
October 5, 2011 at 7:31 pmHi 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 -
Dan Ebberts
October 5, 2011 at 7:58 pmHave you tried it on multiple layers? It’s a pretty subtle rotation. Zero degrees is within the random range of -5 to +5.
Dan
-
Birgit Rathsmann
October 5, 2011 at 8:32 pmI 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,
BirgitPosition: everyone converges on a target point at marker 2target = [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
}
-
Dan Ebberts
October 5, 2011 at 8:43 pmIt 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
Reply to this Discussion! Login or Sign Up