Logic node
Integrator
Accumulates its input over time — the running sum ∫ value · dt — turning a rate into a position. Feed it 90 and you get a value climbing by 90 per second: an endless rotation drive, an energy meter, a progress ramp. An optional leak relaxes the accumulated value back toward a base, and Counter-style limit modes (Clamp, Loop, Ping-Pong) keep the result inside a range. Three input modes cover continuous rates, discrete trigger events, and change-detection accumulation.
Inputs
| Port | Type | Default |
|---|---|---|
| ValueWhat gets accumulated — a rate per second, or the step added on each trigger or data change, depending on Mode. Negative values wind the total back down. | float | 0 |
| ModeHow the value piles up: Per Second integrates continuously, On Trigger adds a step per rising edge, On Data Change adds only when the value actually changes. Anything else behaves as Per Second. | int | 0 |
| TriggerThe rising edge that adds one step in On Trigger mode. A signal that is already true on the very first frame counts as an edge. Hidden unless On Trigger is selected or a cable is attached. | bool | false |
| LeakHow quickly the total relaxes back toward Reset Value, per second. Negative values count as 0; 0 is a perfect integrator, roughly 1…5 gives the classic pulse-and-decay energy meter. | float | 0 |
| ResetA rising edge sends the total straight back to Reset Value. A signal already true at startup is ignored, and within a frame the reset happens before anything is added. | bool | false |
| Reset ValueWhere the total starts, where Reset sends it, and the base that Leak pulls toward. Any value works — it does not have to be 0. | float | 0 |
| LimitWhat happens at the bounds: Off runs free, Clamp stops at Min and Max, Loop wraps around, Ping-Pong reflects. Values outside the list behave as Clamp. | int | 0 |
| MinLower bound used by Clamp, Loop and Ping-Pong. If it ends up above Max the two swap automatically; equal bounds freeze the total there. Hidden while Limit is Off. | float | 0 |
| MaxUpper bound used by Clamp, Loop and Ping-Pong. Min 0 with Max 360 and Loop gives endless rotation angles. Hidden while Limit is Off. | float | 1 |
Outputs
| Port | Type |
|---|---|
| ValueWhat gets accumulated — a rate per second, or the step added on each trigger or data change, depending on Mode. Negative values wind the total back down. | float |
| Carry | bool |
| At Limit | bool |
How It Works
Timekeeping. Integration runs on the node's own wall clock. Each frame it measures the real elapsed time dt since its previous evaluation; the deltas telescope to true elapsed time, so frame drops, stalls, or double processing cannot bend the result. Negative or non-finite dt is treated as 0.
Per-frame order of operations (this order is part of the contract):
- Reset — on a rising edge of the Reset input (or the inspector's "Reset Now" button), the value snaps to Reset Value. Reset is applied first, so a Reset and an accumulation in the same frame start from the fresh base.
- Leak — if Leak > 0, the value relaxes exponentially toward Reset Value:
value = base + (value − base) · e^(−Leak·dt). Leak runs continuously in every mode. - Accumulate — according to Mode (table below).
- Limit — the configured limit mode is enforced; Carry and At Limit are computed here.
Modes:
| Mode | Value means | Accumulation rule |
|---|---|---|
| Per Second (0, default) | a rate per second | value += Value · dt every frame — frame-rate independent |
| On Trigger (1) | a step size | value += Value once per rising edge of Trigger |
| On Data Change (2) | a step size | value += Value whenever Value differs from the previously observed Value (exact comparison) |
In On Data Change mode the first observed value counts as new data, so one addition happens on the first frame — events pass through startup. The comparison is exact, which makes this mode intended for stepped or event-like signals; a continuously varying input would add every single frame.
Limit modes (identical set to the Counter node):
| Limit | Behavior | Carry | At Limit |
|---|---|---|---|
| Off (0, default) | unbounded | never | never |
| Clamp (1) | value stops at Min/Max | 1-frame pulse when clamping occurs | level: true while sitting exactly at Min or Max |
| Loop (2) | wraps into [Min, Max) — accumulate angles 0…360 | 1-frame pulse on each wrap | never |
| Ping-Pong (3) | reflects between Min and Max | 1-frame pulse on each bounce | never |
Min and Max are order-independent — the node internally sorts them. If Min equals Max, the value pins to that point and At Limit stays true.
Edge conventions (system-wide, shared with Do Once and Counter): Trigger counts a startup-true input as a rising edge (events pass through app start); Reset ignores a startup-true input (a held-true Reset cable must not clear the node on frame one); within one frame Reset applies before accumulation.
State lifecycle. The accumulated value, edge memories, and clock are volatile — never saved. Loading a project restarts the Integrator at Reset Value. If the value ever becomes non-finite it is snapped back to Reset Value (NaN protection).
Inspector. Mode and Limit appear as dropdowns; the Reset row shows a "Reset Now" button (works alongside a wired Reset cable) plus the live value. The Trigger port is hidden unless Mode is On Trigger, and Min/Max are hidden while Limit is Off — connected ports are never hidden.
Parameters in Depth
Value (float, default 0) — the quantity being integrated. In Per Second mode it is a rate (units per second); in On Trigger and On Data Change it is the step added per event. It may be negative (accumulate downward) and can itself be animated.
Mode (int, default 0 = Per Second) — selects the accumulation rule: 0 Per Second, 1 On Trigger, 2 On Data Change.
Trigger (bool, default false) — the event input for On Trigger mode; each rising edge adds Value once. A float cable counts as true above 0.5. Ignored in the other modes (and hidden in the inspector unless relevant).
Leak (float, default 0) — per-second exponential relaxation toward Reset Value; negative entries are clamped to 0. 0 is a perfect integrator (remembers forever). Small values (0.1–1) give slow decay, larger values snappy falloff; after 1/Leak seconds roughly 63% of the distance to base has decayed. Leak runs every frame in all modes, enabling the classic pulse-and-decay "energy" pattern when combined with On Trigger.
Reset (bool, default false) — rising-edge reset to Reset Value. Startup-true is ignored by design. The inspector's "Reset Now" button performs the same reset on the next processed frame.
Reset Value (float, default 0) — the base: the starting value on first frame, the target of Reset, and the attractor the Leak relaxes toward.
Limit (int, default 0 = Off) — 0 Off, 1 Clamp, 2 Loop, 3 Ping-Pong (see table above).
Min (float, default 0) / Max (float, default 1) — the active range for Clamp/Loop/Ping-Pong. Swapped automatically if entered in reverse. For angle wrapping use Min 0, Max 360 with Loop.
Outputs: Value (float) — the accumulated result; Carry (bool) — a one-frame pulse on wrap, bounce, or clamp hit, ideal for cascading; At Limit (bool) — a level that is true while the value sits at Min or Max in Clamp mode.
Use Cases
- Endless rotation with live speed: Constant (90) → Integrator (Per Second, Limit: Loop, Min 0, Max 360) → Canvas (Rotation Z) spins a texture at 90°/s forever without float blow-up; modulate the Constant with an LFO for ebb-and-flow spin.
- Beat energy meter: Audio Beat Detection (Kick) → Integrator (On Trigger, Value = 0.3, Leak = 2, Limit: Clamp 0…1) → Circle 2D (Radius) — each kick pumps the radius up, the leak lets it sag back between hits.
- Throttle/charge bar: Keyboard (key held) → Integrator (Per Second, Value = 0.5, Limit: Clamp 0…1) → Rectangle (Width) → Canvas fills a bar while the key is down; wire the same key through Logic (NOT) into a second Integrator subtracting, or just use Reset for instant discharge.
- Auto-advancing slideshow: Integrator (Per Second, Limit: Loop) whose Carry output → Counter (Count Up) → Switch (Index) flips to the next image source every time the ramp wraps — a free-running sequencer built from two nodes.
- Mouse-flick inertia: Delta (of Mouse X) → Integrator (On Data Change, Leak = 1) accumulates only fresh movement and coasts back to center, giving flick-and-decay panning for a Canvas Position X.
- Scan back-and-forth: Constant (1) → Integrator (Per Second, Limit: Ping-Pong, Min −1, Max 1) sweeps a Particle Emitter's X position side to side; Carry pulses at each edge can trigger a color change via Counter → Switch.
Tips
- Integrator is the antidote to the classic
angle += speedframe-rate bug: because it integrates against real elapsed seconds, the same patch runs identically at 60 and 120 fps. - Carry is a one-frame pulse — route it into Counter, Do Once, or another Integrator (On Trigger) for cascading; At Limit is a level meant for gating (e.g. Logic AND) in Clamp mode.
- In On Data Change mode, connecting a continuously varying signal (an LFO, mouse position) adds on virtually every frame — that mode is for stepped, event-like data. Use Per Second for continuous inputs.
- Leak pulls toward Reset Value, not toward zero — set Reset Value to your resting point (e.g. 0.5 for a meter that idles mid-scale).
- State is volatile: every project load restarts from Reset Value. Don't rely on the accumulated value surviving a save/load cycle.
- Related nodes: Counter (integer event counting with the same limit modes), Delay (recall past values instead of summing them), Smooth (low-pass a signal rather than integrate it), LFO (deterministic cyclic ramps when you don't need input-driven accumulation).
Open Integrator in the interactive catalog →
Integrator is one of 381 nodes in Grafit Pro.
Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.