Article Focus:In this tutorial, CreativeCOW contributing editor Tony Agliata demonstrates how simple expressions can generate multiple custom particles in Particular to create an animation of bouncing, floating Ping Pong balls--similar to a those in a lottery drawing.

I recently needed to create an animation of bouncing lotto balls for a commercial and this was part of what I came up with. It was also the first time I was able to utilize some expressions with out looking at a tutorial of some sort. I am by no means an expert on expressions, but I dabble. With this project some of that dabbling finally started to gel. So that was cool. Then once I finished I realized this was a nice little project to share. It involves some AE basics like pre-comping, dives into Particular, and uses some simple expressions. And it's all done inside AE. So even if you never need a lotto ball animation, there's still some useful stuff here.

We need to create our ping pong ball. So the first thing we'll do is create the texture map. We need to create a comp at 250 x 125 and 45 frames in duration.

It's important that the width of the comp is twice the height. Name it something relevant like "Ball Map". Then hit Cmd - Y to bring up the create solid dialog. Check the "make comp size" box and choose white for the color. Then choose a font, I thought Impact looked good, and place a number 1 in the center of the comp. Make sure the justification is set to center and the number is not too huge. A font size of 46 worked well here.

Click image above to see larger graphic.

Now we get to use our first expression. Fear not my friends, it's a simple one. Twirl down the triangle on the text layer, then the triangle next to the word text, then option click on the stop watch next to source text. Type this into the expressions field: timeToFrames(time)+1 and hit return. What this does is tell After Effects to change the source text as time goes by. So we get numbers changing to reflect what frame we are on. The + 1 at the end of the expression starts us out on 1 instead of zero. So frame 0 displays a 1 and frame 1 displays a 2, and so on.

Click image above to see larger graphic.

Do a RAM preview to make sure it's working and save your project.

Next we make the ping pong ball. Make a new comp sized 150 x 150 and 45 frames in duration. Call it "Ball Set-Up" or something relevant. I am all about taking a few seconds and naming things properly. It saves you head aches later. Drag your Ball Map comp into your new comp. Go to the Effect drop down and choose Perspective > CC Sphere. Adjust the Radius to about 60. This should create a nice-sized ball in the center of the comp. Now we'll adjust the Light and Shading settings in CC Sphere to give us a well-lit ball with some dimension to it. Set the Light Height to 100. Next, under Shading set Ambient to 40, Diffuse to 75, Spec. to 0.

Click image above to see larger graphic.

Time for more expressions. Again, simple but effective. We are going to employ what I believe to be the simplest and most useful expression of all. The "Wiggle" expression. If you are not yet familiar with wiggle, it creates random motion that can be used in all kinds of practical ways. If you only learn one expression ever, wiggle should be the one. I use it all the time. We are going to use it to alter the direction the ping pong ball is facing on each frame. So each frame will have a different number and be facing a different way. Why we are doing this will become clear when we put it all together. For now, just play along.

The wiggle expression looks like this: wiggle(30,40)
The first number is how often the parameter changes, the second number determines how much change occurs in either pixels or degrees, depending on what property it's controlling.

Now twirl down the triangle next to the CC Sphere effect in the time line. Then twirl the triangle next to rotation. Option click on the stopwatch next to Rotation X and enter this into the expression field: wiggle(30,40).

Hit return and do the same for Rotation Y and Rotation Z. Now it's important to leave the first number in the expression at 30, as we need a new value on each frame. However, feel free to experiment with the second number until it looks the way you like. I settled with 40, 40, and 70 in the X, Y and Z respectively.

Click image above to see larger graphic.

Let's do a RAM preview (Shift + 0) to have a look. You should now have a ping pong ball that faces a different direction on each frame with numbers that change as well. Now let's save and move on.

Now we start putting it all together. Create a new comp. Choose D1 NTSC Widescreen Square Pixels. 20 seconds long. Call it Assemble.

Create a new solid and call it "Ping Pong Balls" set to comp size. Color doesn't matter. Apply Particular to this layer. Add another solid, comp size, any color.

Add a Ramp effect and make a nice background for your animation. Next, drag the comp "Ball Set-Up" into the current comp and turn off visibility. We are going to use this to generate our custom particles. It just has to be in the same comp as your layer with the Particular effect. Last, but not least, create a new camera layer set to 50mm.

Click image above to see larger graphic.

If you have not used Particular before, it can seem a bit intimidating. But it's actually set up in a logical way and once you get over the fear factor it makes sense. So, if you have not used it before I would suggest taking a little time and looking it over. Once you have, here's what we do.

First, set a keyframe for particles/sec and set to 45. Then at 45 frames set it to 0. Highlight both keyframes, right click, and select Toggle Hold Keyframe. This will give us 45 balls floating around, one of each number we set up in the Ball Set-Up comp. Set the emitter type to Sphere, Velocity to 250, Emitter size to 1000, 500, and 500, on the X, Y and Z respectively. Also check to make sure the Direction drop down is set to Directional.

Click image above to see larger graphic.

Under Particle, set Life to 20 (we'll revisit this with an expression later), and Particle Type to "Custom". Twirl down the Custom triangle,and set Layer to "Ball Set-Up" and TIme Sampling to "Random - Still Frame". This is very important. What this does is grab a random still frame from the Ball Set-Up comp and uses it to generate a custom particle at that point in time. That's why we set it to have a different number on each frame. This is a very cool feature and part of what makes Particular such a powerful tool. Next, set Rotation Speed to 0.5 and Size to 70. This would be a good time to save.

Now let's give this some life. Under "Physics" twirl down "Air" and set Air Resistance to 3.2. This kind of pushes back against the particles motion. Set Spin Amplitude to 600 and Spin Frequency to 2. Hit save and we are done. Set your comp in Point to about 2 seconds and render out a movie to check it out.

Extra Credit: There's one more thing to do here that's kinda cool. If you go to Particle Life(sec) and option click the stop watch then type this expression:
thisComp.duration.

Click image above to see larger graphic.

This will link the particle life to the length of the comp. So if you need to change the length of the comp, the particle life will change accordingly. Cool huh?

Giampietro Balia is right about the repeating numbers, but an easy fix in case anyone is still looking - set the particle frame sampling to "Current Frame - Freeze" and make the "particles per second" the same as your frame rate. Setting it to zero when all your numbers have been revealed.

I don't want to sound too annoying but...there's one problem with this technique.
If you tell AE to take one random frame from the comp in which you set up the ball with the number on it, it might take twice the same number and, as we all know, at the lottery there are no duplicates, one number appears once only.
This is a bit tricky, don't know if there might be an expression for limiting AE to take only once each frame solving this way the problem of duplicate numbers at the same moment on the final output.

Interesting tutorial though, gave me some more ideas on how to use particles ;)

Particular Basic Training Session FOUR: Sticky SnowPlay VideoIn this fourth tutorial in the Particular Basic training series, Michael Park answers a user's forum question on how to accumulate particles on 2d footage using Particular. He will demonstrate a very handy technique to create an interactive layer perfectly tailored to the background elements and then have particles accumulate on those surfaces. As always, the project file is available for free download to reverse engineer or simply try out.

Particular Basic Training Session THREE: The 3D StarfieldPlay VideoIn this third installment of the Particular Basic Training series, Michael Park will show how to use Particular to create a realistic 3d star field for all of your animation needs. Along the way, he will use and explore some features of Particular including motion blue, high dynamic range, and the physics time factor. As always, the project is available for free download.

Particular Basic Training Session TWO: The Stargate WormholePlay VideoIn this second Particular basic training tutorial, Michael Park will demonstrate how to recreate a portion of the wormhole sequence from the movie "Stargate" using Trapcode Particular and Adobe After Effects. Along the way, he will discuss some of the nuances of the wind and gravity forces available to use inside Particular as well as in in-depth discussion of the use and limitations of the built-in motion blur and a workaround using auxiliary particles.

Particular Basic Training Session ONE: The FountainPlay VideoIn this tutorial, Michael Park will teach some basic skills for using Trapcode Particular by creating jets of water using particles to enhance a still image of a fountain. In doing so, he will explain some critical features of Particular and new features of Particular 2.0 while using some built-in effects to pull the scene together.

Creating a 3d Winter Scene with Photoshop and ParticularPlay VideoIn this video tutorial, Michael Park spreads a little Holiday cheer by creating a stylized Winter scene, complete with true 3d text and a forest of trees. Along the way, Mike will demonstrate how to create 3d text inside of Photoshop, and then import and integrate and animate that text in After Effects. Unlike other methods utilizing only After Effects, this method creates true 3d extruded text using Photoshop's 3d capabilities inside of After Effects. In addition, Mike will show how to populate and custom color an entire forest with Particular in a manner of minutes. The only thing you need to bring is the hot chocolate.

Trapcode Particular: Fall Transition EffectPlay VideoIn this tutorial, Michael Park will demonstrate how to create a festive fall transition using some leaf textures along with Trapcode Particular. He will show how the new capabilities of Particular 2.0, including true 3d rotation and dynamic interaction with lights, can make a simple linear wipe interesting and unique. He also gets to show off his three beautiful daughters.

Text to Sand using ParticularPlay VideoIn this video tutorial, Michael Park demonstrates how to use Trapcode Particular to turn text into sand. During the process, he will show both how to make the text blow away like find dust into the wind, or drop onto a floor layer like heavier sand. This tutorial was made in order to answer a question posted on the Trapcode forum requesting assistance in creating this effect using Particular.

Underwater Bullet Trails with Trapcode ParticularPlay VideoUsing After Effects and Trapcode Particular, Michael Park demonstrates how to take a simple picture of a bullet, and step-by-step, create an underwater environment with lead flying everywhere. Along the way, various aspects of Particular will be explored and explained.

Creating a WaterfallPlay VideoIn this video tutorial, Creative Cow leader Michael Park demonstrates how to create a waterfall using After Effects and Trapcode Particular. This tutorial is in response to a couple of posts on the Trapcode Forum of CreativeCOW.net looking for this type of effect. This tutorial uses Particular 2.0, but the work flow and settings should work equally will with previous versions of Particular.