Functions for modulating values.
Examples for importing:
import { Modulation } from "https://unpkg.com/@ixfx/bundle"
import { jitter } from "https://unpkg.com/@ixfx/modulation/bundle"
import * as Modulation from "@ixfx/modulation.js"
import { jitter } from "@ixfx/modulation.js"
Returns a 'crossfader` function of two easing functions, synchronised with the progress through the easing.
Creates an easing function using a simple cubic bezier defined by two points.
WIP Returns a Drifter that moves a value over time.
Returns a roughly gaussian easing function
Interpolates between a
and b
by amount
. Aka lerp
.
Interpolate between angles a
and b
by amount
. Angles are in radians.
Interpolates between A->B over duration
.
Given the same A & B values, steps will be larger if it's a longer
duration, and shorter if it's a smaller duration.
Returns a function that interpolates from A to B.
Jitters value
by the absolute jitter
amount. Returns a function.
Returns a Jitterer that works with absolute values, ie. values outside of 0..1 range.
Mixes in modulation. This is used when you want to fold in a controllable amount of modulation.
Returns a modulator that mixes between two modulation functions. Both modulators are given the same input value.
Ping-pongs continually back and forth a lower
and upper
value (both inclusive) by a given interval
. Use pingPongPercent
for 0-1 ping-ponging
Continually loops up and down between 0 and 1 by a specified interval. Looping returns start value, and is inclusive of 0 and 1.
Returns a function that shapes a 0..1 value as a sine waveform. An input value of 0 will be the very beginning of the wave cycle, input of 1 will be the end, 0.5 will be them middle and so on.
Produces values according to rough spring physics. å
import { continuously } from "@ixfx/flow.js"
import { spring } from
Spring-dynamics modulator. To have spring driven by time or ticks, use spring or springValue. This is a lower-level function.
The same as spring but instead of a generator we get a value. When the spring is done, 1 is returned instead of undefined.
Returns a function that shapes a 0..1 value as a square waveform.
Creates an modulator based on ticks.
Produce modulate values with each invocation. When the time is complete, the final value continues to return. Timer starts when return function is first invoked.
Produce values over time. When the modulate function is complete, the final value continues to return. Timer starts when return function is first invoked.
Creates an modulator based on clock time. Time starts being counted when modulate function is created.
A factory function for creating a timing source. It returns a function which creates a designated timer.
Returns a function that shapes a 0..1 value as a triangle waveform.
Creates a wave modulator by name.
Returns a wave-shaping modulator with a source and shaper as input.
Returns a random number, 0..1, weighted by a given easing function.
Default easing is quadIn
, which skews towards zero.
Weighted average
Returns a random number, 0..1, weighted by a given easing function.
Default easing is quadIn
, which skews towards zero.
Use weighted to get a value directly.
Easing name
Interpolation options.
A function that modulates v
.
A mod source returns numbers on a 0..1 scale. Usually invoked just a function, some sources also support 'feedback' allowing source to be adjusted dynamically.
Function that modulates a wave
Options for the wave function. Defaults to a sine wave of one cycle per-second.
Wave shaper feedback. Feedback allows you to dynamically control tempo for advanced uses.
Options for producing weighted distribution
A 'no-op' function. Returns the input value without modification. Useful for when some default is needed
A series of arcs, sort of like a bouncing ball.