After this lesson
- Build repetition with remainder.
- Distinguish sawtooth, triangle and smooth waves.
- Avoid confusing steps with a frame-rate change.
Before you start
- Composition
- A separate Fusion Composition. 1920×1080, square pixels, 25 fps.
- Parameter
- Merge1 → Blend
- Range
- Start at comp.RenderStart. Reference frames are local unless stated otherwise.
Repetition is not limited to sine waves. Counters, scanning indicators and back-and-forth motion need different signal shapes. Decide whether the cycle boundary should be continuous.
Sawtooth cycles
(time-start)%60 returns a repeating local count. Dividing by 60 gives a range from 0 to just below 1. The next cycle jumps back to zero.
This suits scanning and looping progress. The jump is visible on opacity; for a full-turn rotation, the beginning and end can look identical.
There and back
A triangle wave rises from 0 to 1 over 60 frames and returns over the next 60. Position is continuous, but velocity changes sign abruptly at the turning points.
1 - math.abs(((time - comp.RenderStart) % 120) / 60 - 1)Steps without changing fps
math.floor((time-start)/6) changes once every six frames. It controls the input value, not the video frame rate. Add %4 for four repeating states.
Check the export join between its last and first frames. For period 60, use 60 consecutive samples such as 0…59; frame 60 already repeats the next cycle start.
Choose the signal shape for the motion
A sawtooth ramp rises uniformly and jumps back to zero. It works for a cyclic phase, but directly driving position creates a visible jump. A triangle wave travels out and back: its value is continuous, but direction changes abruptly at each peak, producing a mechanical reversal.
Sine motion slows near its extremes. Replacing one formula with another changes the character of the animation, not merely the smoothness of a graph. Use sawtooth for a scanning indicator, sine for swaying and steps for discrete states.
How many frames should repeat?
A 120-frame triangle period splits into 60 rising and 60 falling intervals. Use 0…119 in a looping clip; frame 120 is the new zero. With a non-integer period, the boundary can fall between frames, so integer-frame renders need not contain the exact maximum.
A stepped formula changes only at its chosen boundaries, while the project remains at, for example, 25 fps. Several consecutive frames may have the same value. This discretizes the control without changing the time grid of the video.
math.floor((time - comp.RenderStart) / 10) % 4Parameters and ranges
| Parameter | What it changes | Example / check |
|---|---|---|
| 120 | The complete ping-pong period. | 60 intervals out and 60 back. |
| % | Wraps the phase into the period. | Times before the start may produce a different phase; clamp local time if needed. |
| floor(t/10)%4 | Four states of 10 frames each. | A 0…3 result cannot directly drive Blend. |
USE IN A COMPOSITION
Build it in Fusion
Merge1 → Blend
Solid lines are node connections in the Flow. A dashed line is a parameter dependency configured in the Inspector.
Connections by port and parameter4
Color is determined by the destination input. Dashed connections are configured in the Inspector; they do not add an RGBA wire to the Flow.
Assembly steps
- Connect Background1 to the yellow input of Merge1, Text1 to the green input, and Merge1 to MediaOut1. Enable Expression on Blend.
- Paste the triangle wave.
- Check local frames 0, 30, 60, 90 and 120.
- Compare with a sine wave: their turning points behave differently.
1 - math.abs(((time - comp.RenderStart) % 120) / 60 - 1)Expected result. Values are 0, 0.5, 1, 0.5 and 0. The turning points are sharper than a sine wave.
Checkpoints
| When / what to check | Expected | Why check it |
|---|---|---|
| 0 | 0 | Start of the rise. |
| 30 | 0.5 | Halfway up. |
| 60 | 1 | Turning point. |
| 90 | 0.5 | Halfway down. |
| 120 | 0 | Start of the next cycle. |
INTERACTIVE EXAMPLE
Change a parameter. Compare the result.
One cycle: appear and disappear
Merge1 → Blendunder control.MERGE → BLEND
A triangle wave travels 0 → 1 → 0. The period includes both halves of the movement. Velocity changes abruptly at the turning point.
With period 120, frames 0, 30, 60, 90 and 120 give 0, 0.5, 1, 0.5 and 0.
Formula for the current settings +
1 - math.abs(((time - comp.RenderStart) % 120) / 60 - 1)This is a ping-pong Blend formula, not an fps change or a smooth sine wave. With an even period, the peak falls on a whole frame.
Errors and troubleshooting
A jump at the sawtooth boundary
That is a property of a sawtooth, not a render error. Choose triangle or sine if the jump is unwanted.
Steps look like dropped frames
Reduce the step size or apply steps to an indicator rather than smooth camera movement.
Independent exercise
Create four states 0, 1, 2 and 3, each lasting eight frames.
Show the solution and explanation
math.floor((time-comp.RenderStart)/8)%4. RenderStart…RenderStart+31 contains one cycle.
Continue learning
Official sources
An original educational walkthrough. The browser model explains the principle but does not run Fusion. Control placement depends on the version; save the original composition before replacing a parameter's control source.