lastNoteFrameCount#
variableoav-p5lastNoteFrameCount
The frameCount of the frame that saw the last key go down: frameCount - lastNoteFrameCount is how many frames ago.
The frame-counting twin of lastNoteTs: 0 in the first frame after the key, then 1, 2, 3 …
- Type
Number
A frame number, on the same count as frameCount, set with note; -Infinity before any key. Since oav-p5 0.8.3.
Examples
function setup() {
createCanvas(400, 300);
noStroke();
}
function draw() {
background(20);
const f = frameCount - lastNoteFrameCount; // frames since a key went down
fill(120, 190, 255);
circle(200, 150, max(0, 200 - f * 5)); // shrinks by 5 px a frame
}Related
lastNoteTsWhen the last key went down, on themillis()clock:millis() - lastNoteTsis how many ms ago.noteThe MIDI number (0 to 127) of the last key pressed.notePressed()You define this function; oav-p5 calls it each time a key (or a pad) goes down.lastKickFrameCountTheframeCountof the frame that saw the last kick (snare, hat, beat):frameCount - lastKickFrameCountis how many frames ago.