Nodes/FizzNodes/SawtoothWave πŸ“…πŸ…•πŸ…
ComfyUI Node Runs on cloud

SawtoothWave πŸ“…πŸ…•πŸ…

A ramp that resets β€” build a scanning or sweeping motion in one node

By FizzleDorfΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 479
SawtoothWave πŸ“…πŸ…•πŸ…
    • FLOAT
    • INT
    β—„phase1β–Ί
    β—„step_increment0.5β–Ί
    β—„x_translation0β–Ί
    β—„start_value0.50β–Ί
    β—„current_frame1β–Ί

    SawtoothWave is the wave that doesn't come back down - it climbs, then instantly jumps back to the start and climbs again. Imagine a value creeping upward over a set number of frames, then snapping to zero for a single frame before resuming. That's a sawtooth, and it's exactly what you want for scanning lines, progress-style sweeps, or any effect that should build up and then reset like a counter hitting its limit.

    It's also the odd one out in the wave family in a good way: its inputs are phase, step_increment, x_translation, start_value, and current_frame - no amplitude, no y_translation. The formula makes the difference obvious:

    value = start_value + step_increment Γ— (current_frame % phase) βˆ’ x_translation
    

    Every phase frames, current_frame % phase wraps back to zero, so the value resets to start_value βˆ’ x_translation and starts climbing again. step_increment is how much it rises per frame - crank it and the ramp gets steeper; phase sets how long each ramp runs before the snap. x_translation nudges the whole thing down. Output is FLOAT with an INT twin.

    When you'd reach for it

    The reset is the whole point. Use it for a sweep that repeatedly builds and vanishes - a radar-style ping, a bar that fills and empties, a scanline traveling down a frame, a light that grows then restarts. It's also quietly useful as a frame counter: because it's built on current_frame % phase, it gives you a number that increments within a fixed window, which is a neat way to drive a looping animation without writing a schedule.

    Install and gotchas

    It's in the FizzNodes pack, so: ComfyUI Manager β†’ search FizzNodes β†’ install β†’ restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/FizzleDorf/ComfyUI_FizzNodes
    cd ComfyUI_FizzNodes && pip install -r requirements.txt
    

    Only numpy, pandas, numexpr - no models. Under FizzNodes πŸ“…πŸ…•πŸ… β†’ WaveNodes.

    The one surprise is the one-frame discontinuity: the value hits its peak and drops to the floor in a single frame, so if your output parameter has a visible jump there, that's the sawtooth working as intended - switch to TriangleWave if you wanted the climb to go back down smoothly. And same as its siblings, it needs current_frame to advance; in a single still render it outputs one constant number and looks inert.

    CategoryFizzNodes πŸ“…πŸ…•πŸ…/WaveNodes

    Inputs (5)

    NameTypeDefaultDescription
    phaseFLOAT10–9999β€”
    step_incrementFLOAT0.50–9999β€”
    x_translationFLOAT00–9999β€”
    start_valueFLOAT0.500–9999β€”
    current_frameINT10–9999β€”

    Outputs (2)

    NameTypeDescription
    FLOATFLOATβ€”
    INTINTβ€”