Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 102 lines (81 sloc) 1.828 kB
3acfdfe @mhenstell added warping
mhenstell authored
1 class WarpSpeedMrSulu extends Routine {
f02d159 @cibomahto Tweak warp mode
cibomahto authored
2 int NUM_STARS = 200;
3acfdfe @mhenstell added warping
mhenstell authored
3 WarpStar[] warpstars;
4
5 void setup(PApplet parent) {
6 super.setup(parent);
7 warpstars = new WarpStar[NUM_STARS];
8 for (int i = 0; i<NUM_STARS; i++) {
9 warpstars[i] = new WarpStar();
10 }
11 }
12
13 void draw() {
ce1845d Refactored to use Config class
Justin Day authored
14 draw.background(0);
15 draw.stroke(255);
3acfdfe @mhenstell added warping
mhenstell authored
16
17 for (int i=0; i<NUM_STARS; i++) {
18 warpstars[i].draw();
19 }
20
ce1845d Refactored to use Config class
Justin Day authored
21 if (frameCount - modeFrameStart >Config.FRAMERATE*Config.MODE_TIMEOUT) {
3acfdfe @mhenstell added warping
mhenstell authored
22 newMode();
23 }
24 }
25
26
27 }
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
28
29
30 class WarpStar {
31 float x;
32 float y;
33 float len;
89a151d @cibomahto Final version for burning man.
cibomahto authored
34 float vy;
35 float vx;
6f1f119 @cibomahto Wednesday morning, burning man.
cibomahto authored
36
37 float r;
38 float g;
39 float b;
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
40
41 public WarpStar() {
42 this.reset();
43 }
44
45 public void reset() {
ce1845d Refactored to use Config class
Justin Day authored
46 x = int(random(0, Config.WIDTH));
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
47 y = int(random(0, -100));
48
89a151d @cibomahto Final version for burning man.
cibomahto authored
49 // if (random(0,1) > .5) {
50 // vx = random(0, 1);
51 // vy = 0;
52 // len = vx * 5;
53 // }
54 // else {
55 vx = 0;
56 vy = random(0, 1);
57 len = vy * 5;
58 // }
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
59 }
60
61 public void draw() {
89a151d @cibomahto Final version for burning man.
cibomahto authored
62 x = x + vx;
63 y = y + vy;
6f1f119 @cibomahto Wednesday morning, burning man.
cibomahto authored
64 //RGB 252/23/218
ce1845d Refactored to use Config class
Justin Day authored
65 //r = int(map(y, 0, Config.HEIGHT, 0, 255));
6f1f119 @cibomahto Wednesday morning, burning man.
cibomahto authored
66 //g = 0;
67 //b = 0;
68 //r = 252;
69 //g = 23;
70 //b = 218;
3d9f707 Catch up
Justin Day authored
71 // r = random(232,255);
72 // g = random(230,255);
73 // b = random(230,255);
74
75 r = red(primaryColor);
76 g = green(primaryColor);
77 b = blue(primaryColor);
78
89a151d @cibomahto Final version for burning man.
cibomahto authored
79 // scale brightness.
80 float bright = random(.5,2);
81 r = r*bright;
82 g = g*bright;
83 b = b*bright;
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
84
ce1845d Refactored to use Config class
Justin Day authored
85 draw.stroke(r, g, b);
86 draw.point(x, y);
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
87
88 for (int i=0; i<len; i++) {
9c18f7f @cibomahto Rename things that were confusing
cibomahto authored
89 float intensity = 255 >> i / 2;
6f1f119 @cibomahto Wednesday morning, burning man.
cibomahto authored
90
ce1845d Refactored to use Config class
Justin Day authored
91 draw.fill(color(r*random(.8,1.3),g*random(.8,1.3),b*random(.8,1.3)));
92 draw.stroke(color(r,g,b));
6f1f119 @cibomahto Wednesday morning, burning man.
cibomahto authored
93 //stroke(intensity);
ce1845d Refactored to use Config class
Justin Day authored
94 draw.point(x, y - i);
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
95 }
96
ce1845d Refactored to use Config class
Justin Day authored
97 if (y > Config.HEIGHT) this.reset();
98 if (x > Config.WIDTH) this.reset();
dafd339 @cibomahto Change things, fix up sketches to work on dome.
cibomahto authored
99 }
100 }
101
Something went wrong with that request. Please try again.