OAVp5.record.seconds#
variableoav-p5OAVp5.record.seconds
How long the running take has been going, in seconds, and the length of the last take after it.
Use it as a clock that starts with the take: const t = recordingIsOn ? OAVp5.record.seconds : 0; makes an animation that always begins at 0 in the video. It is the time since the recording began, not the time of the sketch, so it does not count the moment before startRecording().
- Type
Number- Range
0 …
0 at the start, then refreshed four times a second while recording. When the take is saved it is that take's length, and the next take sets it back to 0.
Examples
function setup() {
createCanvas(400, 300);
}
function keyPressed() {
if (key === 'r') startRecording(4);
}
function draw() {
background(20);
const t = recordingIsOn ? OAVp5.record.seconds : 0; // 0 at the first frame of the video
fill(255, 160, 80);
circle(40 + t * 80, 150, 40); // slides right, 80 px a second
if (!recordingIsOn) {
fill(255);
text('press r: the video starts with the circle at the left', 20, 30);
}
}Related
recordingIsOnWhether a recording is running right now.OAVp5.record.stateWhere the recording is:'off','starting','on'or'saving'.startRecording()Records the canvas and the sound your sketch makes into one video file, and returns a promise that says whether the recording began.OAVp5.record.lastTheinfoof the last recording that was saved (the same objectrecordingSavedgot), ornullbefore the first one.