Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 34 lines (25 sloc) 0.487 kb
4342c94b »
2012-05-16 added a night sky animation with twinkling stars
1 class NightStar {
2 float x;
3 float y;
4 int brightness;
5 public NightStar() {
6 this.reset();
7 }
8
9 public void draw() {
10
11 noStroke();
12 this.twinkle();
13 fill(brightness);
14 rect(x, y, 1, 1);
15
16 }
17
18 public void twinkle() {
19 brightness = brightness + round(random(-20, 20));
20 if(brightness > 255){
21 brightness = 255;
22 }
23 }
24
25 public void reset() {
26 x = random(WIDTH*ZOOM);
27 y = random(HEIGHT*ZOOM) * 0.7;
28 println("New star " + x + "/" + y + " ");
29 }
30
31 }
32
33
Something went wrong with that request. Please try again.