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?