open-audiovisual
Search GitHub

oav-p5 reference · Values over time (CHOP)

OAVp5.chop.state#

variableoav-p5
OAVp5.chop.state

Where the @openav/chop module is: 'off', 'loading', 'on' or 'error'.

off until one of these functions is first called, loading while @openav/chop arrives (a few frames), on once it is in, error if it could not be loaded: a card says so and every function then passes its input through. trigger() on its own never loads it, because it only records that something happened.

Type
String
Range
'off' | 'loading' | 'on' | 'error'

Changes the first time a CHOP function is called and once more when the module has arrived. off before any call.

Examples

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

function draw() {
  background(20);
  fill(255);
  text('chop: ' + OAVp5.chop.state, 20, 30);   // off, then loading, then on
  if (frameCount > 30) circle(lag(mouseX, 0.3), height / 2, 30);   // the first lag() loads the module
}
For half a second it says off. The first lag() call then loads the module: loading, then on.

Related

  • OAVp5.chop.module The @openav/chop module itself once it has loaded, otherwise null: the classes and functions the CHOP functions are built on.
  • OAVp5.chop The CHOP functions under one roof, plus the state of the module behind them: OAVp5.chop.lag(…), .state, .slots(), .reset().
  • lag() Follows value smoothly instead of jumping: up in up seconds, down in down seconds (TouchDesigner's Lag CHOP).

p5/oav-p5.js, line 2870

↑ Back to top · All names