change rotation speed after few seconds
in
Programming Questions
•
5 months ago
hi, this change rotation speed after every 8 seconds
but there is jerkiness every time before rotation changes
how to avoid that?
so speed a simply changes to speed b
but there is jerkiness every time before rotation changes
how to avoid that?
so speed a simply changes to speed b
- float x,speed=0.02;
void setup() {
size(640, 360);
noStroke();
fill(255);
rectMode(CENTER);
}
void draw() {
background(51);
if (second() % 8 == 0) {
speed = random(-0.05, 0.05);
}
translate(width/2, height/2);
rotate(x);
rect(0, 0, 180, 180);
x+=speed;
}
1