Files
orx/orx-time-operators/README.md
2020-05-18 14:30:29 +02:00

1.4 KiB

orx-time-operators

A collection of time-sensitive functions aimed at controlling raw data over-time, such as Envelope and LFO.

Usage

Use the TimeOperators extension to tick the operators, making them advance in time.

extend(TimeOperators()) {
    track(envelope, lfo)
}

Envelope

val size = Envelope(50.0, 400.0, 0.5, 0.5)

if (frameCount % 80 == 0) {
    size.trigger() // also accepts a new target value
}

drawer.circle(0.0, 0.0, size.value)

LFO

val size = LFO(LFOWave.Sine) // default LFOWave.Saw

val freq = 0.5
val phase = 0.5

drawer.circle(0.0, 0.0, size.sample(freq, phase))

// or

drawer.circle(0.0, 0.0, size.sine(freq, phase))

Demos

DemoEnvelope

source code

DemoEnvelopeKt

DemoLFO

source code

DemoLFOKt