The wiggle function in After Effects is used in the following format.
wiggle(frequency, amplitude, octaves = 1, amplitude_mult = 0.5, time = t);
• frequency: The frequency of wiggles per second.
• amplitude: The amplitude of the wiggle.
• octaves: The complexity of the noise, with a default value of 1.
• amplitude_mult: The multiplier for the amplitude of each octave, with a default value of 0.5.
• time: The time at which to evaluate the wiggle, with the default being the current time.
In the example above, 1 and 0.5 represent the octaves and amplitude_mult values, respectively. These parameters set the noise complexity and the amplitude multiplier for each octave of the wiggle function. Generally, these values are left at their default settings.
To create a wiggle motion with position values that loop every 3 seconds, the position value at 0 seconds and at 3 seconds must be the same.
Although you can use the wiggle() Expression with only the frequency and amplitude, all the parameters, including the time value, have been specified to adjust the time value accordingly.
frequency = 1; // wiggles per second
amplitude = 200; // amount of pixels to wiggle
wiggle(frequency, amplitude, 1, 0.5, time);
The key to a looping video is ensuring that the start and end connect smoothly. This guarantees that when the video repeats, there are no visual discontinuities, creating an effect that loops seamlessly. Understanding this principle is crucial for various graphic animations. The wiggle function generates movement by randomly varying values, which means it does not naturally loop. To achieve a loop, the start and end values of the wiggle function must be identical. This can be implemented through expressions in the following steps.
To aid understanding, let’s look at an example where we apply the same Wiggle Expression to two stars of different colors. Here, the blue star is set to represent the state of the yellow star 3 seconds earlier. In After Effects, each layer’s Wiggle Expression generates different random values, so we need to set the same seed value to ensure identical random values. This is achieved using the seedRandom() method.
Here is a detailed step-by-step guide explaining this process:
1. Setting the Wiggle Expression
First, apply the Wiggle Expression to both stars (yellow star and blue star). The Wiggle Expression is used to periodically change the position randomly.
2. Setting the Seed Value to Generate Identical Random Values
Even if the same Wiggle Expression is used in After Effects, each layer generates different random values by default. To prevent this and ensure identical random values, use the seedRandom() function to set the seed value. The seed value is the initial value used when generating random values; using the same seed value will yield the same random values.
3. Setting the Wiggle Expression for the Blue Star
Set the position of the blue star to represent the state of the yellow star 3 seconds earlier. To achieve this, apply a time offset. Below is an example code implementing this setting.
Yellow Star Expression
seedRandom(1);
frequency = 1; // wiggles per second
amplitude = 200; // amount of pixels to wiggle
wiggle(frequency, amplitude, 1, 0.5, time);
Blue Star Expression
seedRandom(1);
frequency = 1; // wiggles per second
amplitude = 200; // amount of pixels to wiggle
wiggle(frequency, amplitude, 1, 0.5, time-3);
Based on this background, we blend the position values of the yellow star and the blue star. To achieve this, we use the linear() expression to transition the position value of the yellow star to the position value of the blue star over the course of 0 to 3 seconds.
frequency = 1; // wiggles per second
amplitude = 200; // amount of pixels to wiggle
secondsToLoop = 3; // time to loop in seconds
// Calculate the remainder of the current time to create a 3-second loop.
t = time % secondsToLoop;
// Calculate the wiggle value for the current cycle
wiggle1 = wiggle(frequency, amplitude, 1, 0.5, t);
// Calculate the wiggle value for the previous cycle (to match the start and end values)
wiggle2 = wiggle(frequency, amplitude, 1, 0.5, t - secondsToLoop);
// Use linear interpolation to create the loop effect over the current time
linear(t, 0, secondsToLoop, wiggle1, wiggle2);
The value of secondsToLoop determines the desired looping duration. This concludes our exploration of how to create a looping wiggle() expression.
'After Effects(English ver)' 카테고리의 다른 글
Creating object motion along a path (0) | 2024.07.22 |
---|---|
Creating Lines Connected to Objects Using createPath() in After Effects (0) | 2024.07.14 |
Drawing a Line in 3D Space Using fromComp() in After Effects (0) | 2024.07.08 |
After Effects toWorld() Expression 3D Coordinate Transformation (0) | 2024.06.25 |
Understanding the After Effects Expression: toComp() (0) | 2024.06.20 |