I call this little number the pop wave. Looks pretty simple right? Just some things popping on across the frame in a controlled wave, and the off, and then on and ungulate before off again right? Wrong! This is some pretty cool stuff going on back there.
I’ll break it down for you. There’s only one thing changing here, and it’s a linear wipe. That’s right only a handful of key frames for this awesomeness! The rest is expressions. Those little lines of joy/frustration that make magic out of mole hills.
So the linear wipe, which arguably has some severe alterations to it (feather, fractal noise and the like) is the control layer. What it controls is the individual objects on top which are in comps so they can be swapped out with ease. The expressions are on the rotation for a random seed, and the scale to get that sweet pop.
The random rotation is just a random see generator frozen over time and a random number expression. That’s all that needs be said about that. Each copy made will have a unique number associated with it so cmd+d away!
The second is arguably the most complex thing I’ve dissected. It’s called the sampleimage(). Basically it takes a point on a layer and spits out the R,G,B, and Alpha. You can link that up to variables, and I prefer to make lots of variables in this, to make the function relevant. here’s how it looks for me:
targetLayer = thisComp.layer(“Control”);
samplePoint = transform.position;
sampleRadius = [1,1];
t =110* targetLayer.sampleImage(samplePoint, sampleRadius);
Break it down!
This is applied to the scale parameter of the individual objects. The first line is a variable, you can call it anything but it will be the layer you want the sampleImage to sample or look at, it’s a “what?” qyestion. The next is the samplePoint, again you can call it x or y, and it’s going to be a place holder for where on layer you want to look it’s displayed as [x,y]. The Next is the sampleRadius or how big the sample point should be. I think it’s a circle that eminates from a point up and down the firs character and left and right the second character, so mine was 1,1 but the size is really 2 by 2. Now we put it together calling up an arbitrary variable t. and making it all come into the sampleImage telling it to:
110 times “on this layer”.sampleImage(“here”, “this big”);
Why 110? because the values this thing will make are from 0 to 1, a percentage basically. The 110 makes a value of 1 or pure white (R=1, B=1, G=1, A=1). The value is actually [1,1,1,1] and you can get something from it however you want really but I wanted to make the t 110 when it’s all the way on and 0 when it’s all the way off.
The final line is putting it all to work in the scale parameter that is displayed as [#, #]. In this case it’s the first part,  of the four part output. t is the Red value. So the variable reads [“how much red”, “how much red”]
That’s that, the layer now references what’s at the same spot on the control layer and changes it’s scale from 0 to 110 depending on the colour value. Then that layer animates, which is easy to control and preview before you get hundreds of objects doing the “pop” wave.
Also if you just copy paste my code you won’t be learning so be sure you write it out and understand it best you can to make the most of it later on. Ususally when it would break during my coding it was because I was not giving it the right kind of variable, class 2 versus scalar for example as it can get confusing. If you have any questions, comments, or jeers let me know.