open-audiovisual
Search GitHub

oav-p5 reference · Values over time (CHOP)

OAVp5.chop.slots()#

functionoav-p5
OAVp5.chop.slots()

Lists every memory the CHOP functions are using right now: its kind, how it is found, and its latest value.

For finding out why two calls seem to share a memory, or whether a loop made hundreds: OAVp5.chop.slots().length is how many there are. It reads the state and changes nothing.

Returns

Array<Object> One { kind, key, mode, value } per memory. kind is the function ('lag', 'spring', …). key is '#1', '#2' for calls found by order, a name for named ones, or the line of code for calls matched by line. mode says which: 'order', 'name' or 'site'. value is its latest output (missing for a trail).

Notes

  • This is advanced. 🩺 and tests use it; a sketch rarely needs to.

Examples

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

function draw() {
  background(20);
  lag(mouseX, 0.3);
  lag(mouseY, 0.3);
  spring(mouseX, 100, 6, 'ball');
  fill(255);
  const lines = OAVp5.chop.slots().map((s) => s.kind + ' ' + s.key + ' (' + s.mode + ')');
  text(lines.join('\n'), 20, 30);
}
Lists the memories the three calls are using: two lags found by order and one spring found by its name.

Related

  • 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.
  • 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 2873

↑ Back to top · All names