lastKickFrameCount#
variableoav-p5lastKickFrameCountAlso: lastSnareFrameCount lastHatFrameCount lastBeatFrameCount
The frameCount of the frame that saw the last kick (snare, hat, beat): frameCount - lastKickFrameCount is how many frames ago.
The frame-counting twin of lastKickTs. frameCount - lastKickFrameCount is 0 in the frame where kickIsDetected is true, then 1, 2, 3 …, so a shape can last a fixed number of frames after each hit. Use the Ts version when it should last a fixed time whatever the frame rate.
- Type
Number
A frame number, on the same count as frameCount; -Infinity before the first hit. Since oav-p5 0.8.3.
Examples
function setup() {
createCanvas(400, 300);
startDrums('bd*4, ~ sd ~ sd', 110);
noStroke();
}
function draw() {
background(20);
const k = frameCount - lastKickFrameCount; // frames since the kick
if (k < 10) { // the ring stays for 10 frames after each kick
fill(255, 90, 31);
circle(200, 200, 60 + k * 16);
}
}Related
lastKickTsWhen the last kick (snare, hat, beat) came, on themillis()clock:millis() - lastKickTsis how many ms ago.kickIsDetectedTrue in the one frame after a kick (snare, hat) is heard, from the drum machine or the microphone, likemouseIsPressedfor a hit.lastNoteFrameCountTheframeCountof the frame that saw the last key go down:frameCount - lastNoteFrameCountis how many frames ago.