Function sineShape

  • Returns a function that shapes a 0..1 value as a sine waveform.

    const s = sineShape();
    // Calculate value of sine wave at 50%
    // By default there is one oscillation, thus
    // it will be the middle of the cycle.
    s(0.5);

    The period determines number of cycles for an input value of 1.

    // Oscillate twice in 0..1 range
    const s = sineShape(2);

    No bounds checks are performed on input value. Ensure it is 0..1 (inclusive).

    Parameters

    • period: number = 1

    Returns Modulate