Skip to main content

Volume Ramp

Tweens a number from one value to another over a set time with a chosen easing, frame by frame; wire the output into a Sound volume, a sprite alpha or any number input. Browser only; it never reaches the RGS.

Set From (default 0), To (default 1), Duration (ms) (default 1000) and Easing (default linear), then fire Start. Value snaps to from, Progress to 0, Running becomes true and Tick fires. On every frame Value and Progress update and Tick fires; on the final frame Value is to, Progress is 1, Running is false, and Tick fires before Finished, so a consumer keyed on Tick already reads the final value.

Progress is the plain time fraction 0..1; the easing shapes Value only. Ease-in and ease-out are quadratic, ease-in-out is quadratic on both ends, and an unknown easing name falls back to linear. From and To set in the same update as Start are honoured, and Start while running restarts from from.

Stop freezes Value and Progress where they are and clears Running without firing Finished; it does nothing while idle. Duration (ms) 0 jumps straight to the end in the same update. Two ramps started by the same signal, one 1 to 0 and one 0 to 1, make a crossfade. Frames run on the browser's animation frames, or a timer where none exists, and are cancelled when the node is deleted.

Inputs​

Actions​

SignalDescription
StartStarts, or restarts, the ramp from From; values set in the same update are used.
StopFreezes Value where it is and clears Running; Finished does not fire.

Range​

DataDescription
From (number)Start value. Default 0.
To (number)End value. Default 1.

Timing​

DataDescription
Duration (ms) (number)Length of the ramp, ms. Default 1000; 0 jumps to To at once.
Easing (enum)Curve applied to Value; an unknown name falls back to linear. Default linear. Options: linear, easeIn, easeOut, easeInOut.

Outputs​

State​

DataDescription
Value (number)The eased number between From and To, updated every frame.
Progress (number)Elapsed fraction of the ramp, 0..1, before easing.
Running (boolean)True from Start until the ramp finishes or Stop is fired.

Signals​

SignalDescription
FinishedFires once when the ramp reaches To, after the final Tick; not on Stop.
TickFires at start, every frame while running, and once more with the final value.

Usage​

  1. Add two Volume Ramp nodes: one From 1 To 0 for the outgoing track, one From 0 To 1 for the incoming track, with the same Duration (ms).
  2. Wire each Value into the volume input of its Sound node.
  3. Fire both Start inputs from the same signal.
  4. Stop the outgoing Sound node from the first ramp's Finished.