seedRandom#42

If you've ever played with expressions in After Effects, you've probably does some work with random numbers. For instance the wiggle() function uses random numbers to shake your layer around.

The problem is that if you spend a bunch of time getting your expressions just right, and then add a new layer to your composition, all of that work could be ruined. By default, After Effects uses the layer's index to generate the random numbers. This means that if the layer index changes (the layer's number) then any random numbers it uses will also change.

So how can you avoid this problem? The solution is seedRandom(). seedRandom() allows you to manually control the randomness.

To use seedRandom(), simply add it to your expression before the random number expression. For instance: seedRandom(1); You can change the number from 1 to anything you want. seedRandom() also has a second parameter that can be set to true or false. It is false by default. If you set it to true (eg: seedRandom(1,true)) then the expression will generate a random number once and then it will remain unchanged. You could use this to generate random positions for a bunch of layers without having them jump around every frame.

Now, to solve our original problem, if you are using a random number expression without seed random, and then your layer's index changes, you can use seed random to 'move' it back. If your layers index is 1, thas is the same as seedRandom(0). If your layer's index is 2, that is the same as seedRandom(1) and so on. So by using this expression, you can move layers around all you want without having to rework all of your expressions

Share seedRandom
On Google+ Twitter and Facebook

See All the Tips

Follow Batch Frame

And get all the updates first!


High Quality After Effects Templates