linearly v0.32.0Docs


linearly v0.32.0 / scalar / sawtooth

Function: sawtooth()

sawtooth(x, period): number

Returns a sawtooth wave with the given period. Basically, the output will be the input value modulo period, but returns 1 when the phase is 1. The shape of the wave will be continous for the negative ranges, so when phase is negative integer, the output will be 0, else if phase is negative float, the output will be 1 - fractional part of phase.

Parameters

x: number

the input value

period: number = 1

the period of the wave

Returns

number

See

https://www.geogebra.org/calculator/d3grfqqeopen in new window

Shorthands

Defined in

src/scalar.ts:462open in new window