Skip to content

Commit 1fd7189

Browse files
committed
minor cleanups/edits
1 parent 1f324f9 commit 1fd7189

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

  • content/examples/Basics/Transform/Rotate

content/examples/Basics/Transform/Rotate/Rotate.pde

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,29 @@
88
* method to convert your values. For example: scale(radians(90))
99
* is identical to the statement scale(PI/2).
1010
*/
11-
12-
void setup()
13-
{
14-
size(200,200);
11+
12+
float angle;
13+
float jitter;
14+
15+
void setup() {
16+
size(200, 200);
17+
smooth();
1518
noStroke();
1619
fill(255);
20+
rectMode(CENTER);
1721
frameRate(30);
1822
}
1923

20-
float angle;
21-
float cosine;
22-
float jitter;
23-
24-
void draw()
25-
{
24+
void draw() {
2625
background(102);
27-
28-
if(second()%2 == 0){
29-
jitter = (random(-0.1, 0.1));
26+
27+
// during even-numbered seconds (0, 2, 4, 6...)
28+
if (second() % 2 == 0) {
29+
jitter = random(-0.1, 0.1);
3030
}
3131
angle = angle + jitter;
32-
cosine = cos(angle);
33-
32+
float c = cos(angle);
3433
translate(width/2, height/2);
35-
rotate(cosine);
36-
rectMode(CENTER);
34+
rotate(c);
3735
rect(0, 0, 115, 115);
3836
}

0 commit comments

Comments
 (0)