open-audiovisual
Search GitHub

oav-p5 reference · Values over time (CHOP)

OAVp5.chop#

objectoav-p5
OAVp5.chop

The CHOP functions under one roof, plus the state of the module behind them: OAVp5.chop.lag(…), .state, .slots(), .reset().

Every function of this group is also here: OAVp5.chop.lag, .env, .trigger, .speed, .spring, .trail, .slope, .count, .scope and .drawTrail are the same functions as the plain names, for a sketch whose own speed or count keeps the plain name.

The rest is for looking inside: state says whether the module is loaded, module is the module itself, slots() lists every memory in use and reset() forgets them.

Notes

  • This is advanced: a sketch that only calls lag() and friends never needs it.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  const x = OAVp5.chop.lag(mouseX, 0.4);   // the same as lag(mouseX, 0.4)
  fill(255);
  text('chop ' + OAVp5.chop.state + ', ' + OAVp5.chop.slots().length + ' memory in use', 20, 30);
  circle(x, height / 2, 40);
}
A circle chasing the mouse through OAVp5.chop.lag, with the module's state and the number of memories in use printed above it.

Related

  • lag() Follows value smoothly instead of jumping: up in up seconds, down in down seconds (TouchDesigner's Lag CHOP).
  • env() A 0..1 pulse that jumps up after each event (a kick, a beat, a key, a press) and then fades out: TouchDesigner's Trigger CHOP.
  • OAVp5.chop.state Where the @openav/chop module is: 'off', 'loading', 'on' or 'error'.
  • OAVp5.chop.slots() Lists every memory the CHOP functions are using right now: its kind, how it is found, and its latest value.
  • OAVp5.chop.reset() Forgets the memory named name (a lag, a speed total, a count …), or every memory when you give no name: the next call starts fresh.

p5/oav-p5.js, line 2890

↑ Back to top · All names