Monday 28 January 2013

Random Time


Random Time

In this example, instead of having the time of each layer
wander around, the expression offsets each layer’s playback
time by a random amount. The expression you need
for the Time Remap property is
maxOffset = 0.7;
seedRandom(index, true);
time + random(maxOffset);
The fi rst thing to notice about this expression is the use of
seedRandom() and random() and the relationship between
these functions. If you use random() by itself, you get a different
random number at each frame, which is usually not
what you want. The solution is seedRandom(), which takes
two parameters. The fi rst is the seed. It controls which
random numbers get generated by random(). If you specify
only this parameter, you will have different random numbers
on each frame, but they are an entirely new sequence
of numbers. It’s the second parameter of seedRandom() that
enables you to slow things down. Specifying this parameter
as true tells After Effects to generate the same random
numbers on each frame. The default value is false, so if
you don’t specify this parameter at all, you get different
numbers on each frame. It’s important to note that seed-
Random() doesn’t generate anything by itself. It just defi nes
the subsequent behavior of random().
Here’s an example. This Position expression randomly
moves a layer to a new location in the comp on each frame:
random([thisComp.width,thisComp.height])
This variation causes the layer to stay in one random
location:
seedRandom(1,true);
random([thisComp.width,thisComp.height])

This version is the same as the previous one, except that it
generates a different, single random location because the
value of the seed is different:
seedRandom(2,true);
random([thisComp.width,thisComp.height])
Let’s get back to the Time Remap expression. The fi rst line
creates the variable maxOffset and sets it to the maximum
value, in seconds, that each layer’s playback time can
deviate from the actual comp time. The maximum for the
example is 0.7 seconds.
The next line tells After Effects that you want the random
number generator (random()) to generate the same random
number on each frame.
The last line of the expression calculates the fi nal Time
Remap value, which is just the sum of the current comp
time plus a random offset between 0 and 0.7 seconds.
Next, you would apply the Opacity and Audio Levels expressions
from the wiggle() example so that each layer’s video
and audio will be weighted equally. Duplicate the layer as
many times as necessary to get the effect you like.

No comments:

Post a Comment