OAVp5.chop.slots()#
functionoav-p5OAVp5.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
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);
}Related
OAVp5.chop.reset()Forgets the memory namedname(a lag, a speed total, a count …), or every memory when you give no name: the next call starts fresh.OAVp5.chopThe CHOP functions under one roof, plus the state of the module behind them:OAVp5.chop.lag(…),.state,.slots(),.reset().lag()Followsvaluesmoothly instead of jumping: up inupseconds, down indownseconds (TouchDesigner's Lag CHOP).