Looping problem
in
Programming Questions
•
1 year ago
Hey guys,
I would really like to know how to stop a loop on a specific time (such as: 7 seconds)
PShape logo;
float angle;
float jitter;
void setup() {
size(800,250);
logo = loadShape("logo.svg");
smooth();
frameRate(50);
shapeMode(CENTER);
}
void draw() {
background(255,255,255);
// during even-numbered seconds (0, 2, 4, 6...)
if (second() % 7 == 0) {
jitter = 2.5;
}
angle = angle + jitter;
pushMatrix();
float c = cos(angle);
translate(width/2, height/2);
rotate(angle*TWO_PI/360);
shape(logo, 0, 0, 250, 250);
popMatrix();
}
1