Created
July 21, 2014 15:08
-
-
Save yuskesuzki/478fbf78a18a02d10ab2 to your computer and use it in GitHub Desktop.
Processing sample 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final int RED = 0; | |
final int ORANGE = 1; | |
final int YELLOW = 2; | |
final int GREEN = 3; | |
final int BLUE = 4; | |
final int INDIGOBLUE = 5; | |
final int PURPLE = 6; | |
int COLORMAX = PURPLE; | |
final int RAINBOWSIZEMAX = 250; | |
final int RAINBOWWIDH = 25; | |
void setup() { | |
size(940, 235); | |
noStroke(); | |
background(200,242,255); | |
} | |
void draw() { | |
float w = random(width); | |
float h = random(height-30, height); | |
if(frameCount % 2 == 0) { | |
filter(BLUR, 4); | |
} | |
for(int i=RED; i<=COLORMAX; i++) { | |
strokeRainbowColor(i); | |
strokeWeight((RAINBOWWIDH / 2) + 1); | |
fill(0, 0, 0, 0); | |
arc(w, height, | |
RAINBOWSIZEMAX - (i*RAINBOWWIDH), RAINBOWSIZEMAX- (i*RAINBOWWIDH), | |
-PI, 0); | |
} | |
} | |
void strokeRainbowColor(int count) | |
{ | |
int check = count % (COLORMAX+1); | |
switch(check) { | |
case RED: | |
stroke(237, 26, 61); | |
break; | |
case ORANGE: | |
stroke(255, 183, 76); | |
break; | |
case YELLOW: | |
stroke(255, 212, 0); | |
break; | |
case GREEN: | |
stroke(0, 128, 0); | |
break; | |
case BLUE: | |
stroke(0, 103, 191); | |
break; | |
case INDIGOBLUE: | |
stroke(35, 71, 148); | |
break; | |
case PURPLE: | |
stroke(167, 87, 168); | |
break; | |
default: | |
strokeRainbowColor((COLORMAX+1)+check); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment