Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (25 sloc) 0.487 kB
class NightStar {
float x;
float y;
int brightness;
public NightStar() {
this.reset();
}
public void draw() {
noStroke();
this.twinkle();
fill(brightness);
rect(x, y, 1, 1);
}
public void twinkle() {
brightness = brightness + round(random(-20, 20));
if(brightness > 255){
brightness = 255;
}
}
public void reset() {
x = random(WIDTH*ZOOM);
y = random(HEIGHT*ZOOM) * 0.7;
println("New star " + x + "/" + y + " ");
}
}
Jump to Line
Something went wrong with that request. Please try again.