Sin/Cos
Generates a sinusoidal wave: amplitude × fn(frequency × x + phase°). The fn parameter picks sine, cosine or tangent.
Node
Interactive preview is available in the interactive reader.
Sockets
x (in)- Float. Input variable — typically a ramp or time index.
value (out)- Float. The wave sample at x.
Parameters
Fn- Function — sin, cos or tan. Default: sin.
Amplitude- Peak-to-centre magnitude. Default: 1.
Frequency- Multiplier on x before the trig function. Default: 1 (one cycle per 2π units of x).
Phase °- Phase offset in degrees. Default: 0.
How It Works
The formula is:
value = amplitude * Math.sin(frequency * x + phaseDeg * Math.PI / 180)
(with Math.cos or Math.tan substituted when the Fn parameter is changed). Tangent is unbounded near π/2 — use it only when you want the discontinuity, otherwise prefer sine or cosine.