OAVp5.record.seconds#
變數oav-p5OAVp5.record.seconds
正在錄的這一支已經錄了幾秒,錄完之後是那一支的長度。
當成跟著這一支錄影一起開始的時鐘:const t = recordingIsOn ? OAVp5.record.seconds : 0; 做出來的動畫,在影片裡一定從 0 開始。它是錄影開始之後的時間,不是草圖的時間,所以不包含 startRecording() 之前的那段。
- 型別
Number- 範圍
0 …
一開始是 0,錄影中每秒更新四次。檔案存好之後是那一支的長度,下一支開始的時候又歸零。
範例
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);
}
}相關
recordingIsOn現在有沒有在錄影。OAVp5.record.state錄影現在在哪個階段:'off'、'starting'、'on'或'saving'。startRecording()把畫布和草圖發出的聲音錄成一支影片檔,並回傳一個 promise,告訴你錄影有沒有開始。OAVp5.record.last最近一支存好的錄影的info(跟recordingSaved拿到的是同一個物件),第一支之前是null。