Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (23 sloc) 0.438 kB
a6b64d8 @potatono Refactored everything into separate classes.
potatono authored
1 class RadialStar {
2 float x;
3 float y;
4 float theta;
5 float v;
6
7 public RadialStar() {
8 this.reset();
9 }
10
11 public void draw() {
12 x = x + (v * cos(theta));
13 y = y + (v * sin(theta));
14
15 noStroke();
16 fill(255);
17 rect(x, y, 1, 1);
18
19 if ((x > WIDTH || x < 0) || (y > HEIGHT || y < 0)) this.reset();
20
21 }
22
23 public void reset() {
24 x = 7;
25 y = 7;
26 theta = random(0, 2 * PI);
27 v = random(0.05, 1);
28 }
29
30 }
31
32
Something went wrong with that request. Please try again.