Oscillator
Intro
Deform and affect Shapes using trigonometric wave patterns.
The Oscillator has been updated in Cavalry 2.4. Legacy scenes (scenes created before Cavalry 2.4) will continue to use the old Oscillator but can be manually updated to use the current Oscillator. To do this:
- Save a new version of the Scene.
- Create a new Oscillator.
- Match the new Oscillator's settings to the legacy Oscillator's.
- Replace any existing connections from/to the legacy Oscillator with the equivalent from/to the new Oscillator.
Settings will need to be tweaked in order to closely match the original Scene. In particular:
- Time Scale - It's likely this will need reducing from the original value to match the speed of the legacy Oscillator.
- Frequency - This is now dependent on the new Time Mode so will need adjusting accordingly.
- Frequency - If the Oscillator was being used as a Deformer, note that the new Number of Waves attribute under the Deformer tab should now be used to control the number of waves that the deformation produces. For example, if the legacy Oscillator was being used as a Deformer with a Frequency of
10
, a similar equivalent will be an Oscillator with a Frequency of1
and a Number of Waves of10
.
UI
- Behaviour
- Deformer
Strength Fade to Zero - When checked, Strength (including Falloffs) will interpolate between 0 and the result. When unchecked it will interpolate between the Minimum and Maximum values.
Type - Select a type for the wave:
- Sine - Create a sine wave.
- Cosine - Create a cosine wave.
- Tangent - Create a tangent wave.
Wave Style - Select a shape for the wave:
- Normal - A smooth, curved wave.
- Square - A square wave.
- Triangle - A triangular wave.
- Sawtooth - A sawtooth wave.
- Custom... - Use the Graph to create a custom wave.
Graph - When Wave Style is set to Custom... use the graph to draw a custom wave. See Common Attributes.
Minimum - Set the minimum height of the wave.
Maximum - Set the maximum height of the wave.
Value Offset - Offset the min/max values.
Stagger - When used with a Duplicator this will stagger the movement in time across duplicates.
Separate Channels - Generate different values for x and y.
Time Mode - Determine how the Frequency attribute relates to time (a period is the distance between two peaks of the wave):
- Seconds - The Frequency value represents periods per second. If Frequency is set to
1
and Time Scale is set to1
, a sine wave will move up and down once every second. - Minutes (BPM) - The Frequency value represents periods per minute. If Frequency is set to
60
and Time Scale is set to1
, a sine wave will move up and down once every second.
Frequency - Set the frequency of the waves (a higher number will create more frequent waves).
Time - An auto connection to the Composition's time.
Time Offset - Offset the animation/time (in seconds).
Time Scale - A multiplier for time.
Use Normals - When checked deformation will be based on the normals of the Shape. When unchecked points are scaled from the middle of the Shape.
Number of Waves - Set the number of complete waves to create along/around the Path.
An Oscillator can be set to loop every x
seconds using the Time Mode, Frequency and Time Scale attributes. Where a loop is required over a specific period of frames a Math Utility can be used to create a relationship between FPS and time. For example:
- Create a Shape.
- Right click on the Position attribute >
Add Behaviour > Oscillator > Y
. - Set the Oscillator's Minimum to
-100
and the Maximum to100
. - Create a Math Utility.
- Open the Composition Settings and connect the Frame Rate to the Math's First attribute.
- Enter a value to represent the number of a frames a loop should take into the Math's Second attribute.
- Set the Math's Operation to Divide.
- Connect math.id→oscillator.frequency.
If the Comp's Frame Rate changes, the Oscillator will continue to loop on the frame number entered into the Math's Second attribute.
Alternatively the Math could be replaced with an Attribute Expression by connecting the Composition's Frame Rate to the Oscillator's Frequency and then adding an Attribute Expression of /32
where 32 is the frame number for the Oscillator to loop on.
When using two Oscillators (Sine or Cosine) to create a circular motion, a Time Offset of 0.25
should be added to one of the Oscillators.
When connecting an Oscillator to e.g. position.x on a Shape, use Time Scale to speed up the oscillation.