You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
678 B
Java
29 lines
678 B
Java
int initMillis = 0;
|
|
boolean record = false;
|
|
int frameMillis = 0;
|
|
|
|
void recordTimelapse(float lagtime, float maxtime){
|
|
// checks if record state is turned off
|
|
if (record == false){
|
|
initMillis = 0;
|
|
return;
|
|
}
|
|
|
|
// records the milliseconds elapsed between program start and first frame taken
|
|
if (initMillis == 0){
|
|
initMillis = millis();
|
|
}
|
|
|
|
// automatically turns off recording if maxtime has elapsed
|
|
if (millis()-initMillis > maxtime*1000){
|
|
record = false;
|
|
return;
|
|
}
|
|
|
|
// takes snapshot if enough time has elapsed since last frame was taken
|
|
if ((millis()-frameMillis) >= lagtime*1000){
|
|
snapshot();
|
|
frameMillis = millis();
|
|
}
|
|
}
|