Created
November 20, 2015 13:35
-
-
Save cursorial/8e9d91b78400380b70df to your computer and use it in GitHub Desktop.
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
float[] keycount = new float[26]; | |
float[] xCoords = new float[26]; | |
float[] yCoords = new float[26]; | |
float spaceCount = 0; | |
float spaceXCoords; float spaceYCoords; | |
int count = 0; | |
PImage img; | |
void setup() { | |
String url = "http://www.moshi.com/image/clearguard/layout-us.jpg"; | |
img = loadImage(url); | |
size(595, 249); | |
noStroke(); | |
ellipseMode(RADIUS); | |
xCoords[0] = 100; yCoords[0] = 135; | |
xCoords[1] = 279; yCoords[1] = 173; | |
xCoords[2] = 199; yCoords[2] = 173; | |
xCoords[3] = 179; yCoords[3] = 135; | |
xCoords[4] = 170; yCoords[4] = 97; | |
xCoords[5] = 218; yCoords[5] = 135; | |
xCoords[6] = 258; yCoords[6] = 135; | |
xCoords[7] = 298; yCoords[7] = 135; | |
xCoords[8] = 366; yCoords[8] = 97; | |
xCoords[9] = 337; yCoords[9] = 135; | |
xCoords[10] = 374; yCoords[10] = 135; | |
xCoords[11] = 415; yCoords[11] = 135; | |
xCoords[12] = 356; yCoords[12] = 173; | |
xCoords[13] = 317; yCoords[13] = 173; | |
xCoords[14] = 405; yCoords[14] = 97; | |
xCoords[15] = 444; yCoords[15] = 97; | |
xCoords[16] = 90; yCoords[16] = 97; | |
xCoords[17] = 208; yCoords[17] = 96; | |
xCoords[18] = 141; yCoords[18] = 135; | |
xCoords[19] = 248; yCoords[19] = 97; | |
xCoords[20] = 326; yCoords[20] = 97; | |
xCoords[21] = 238; yCoords[21] = 173; | |
xCoords[22] = 131; yCoords[22] = 97; | |
xCoords[23] = 160; yCoords[23] = 173; | |
xCoords[24] = 287; yCoords[24] = 97; | |
xCoords[25] = 121; yCoords[25] = 173; | |
spaceXCoords = 279; spaceYCoords = 215; | |
} | |
void draw(){ | |
image(img, 0, 0); | |
for(int i = 0; i < keycount.length; i++) { | |
drawGradient(xCoords[i], yCoords[i], i); | |
keycount[i] *= 0.99; | |
} | |
int radius = 10; | |
for(int r = radius; r > 0; --r) { | |
if(spaceCount >= 255) { | |
radius++; | |
spaceCount = 255; | |
} | |
fill((random(0, 360) + 1) % 360, 90, 90, spaceCount * 12); | |
ellipse(spaceXCoords, spaceYCoords, r * 7, r); | |
} | |
spaceCount *= 0.99; | |
} | |
void mousePressed() { | |
println("xCoords[" + count + "] = " + mouseX + "; yCoords[" + count + "] = " + mouseY + ";"); | |
count++; | |
} | |
void keyPressed(){ | |
if(key >= 'a' && key <= 'z'){ | |
keycount[key-97]++; | |
for(float i : keycount) { | |
print(i + ", "); | |
} | |
print("\n"); | |
} | |
if(key == ' ') { | |
spaceCount++; | |
} | |
println((int)key); | |
} | |
void drawGradient(float x, float y, int k) { | |
int radius = 10; | |
for(int r = radius; r > 0; --r){ | |
if(keycount[k] >= 255) { | |
radius++; | |
keycount[k] = 255; | |
} | |
fill((random(0, 360) + 1) % 360, 90, 90, keycount[k] * 12); | |
ellipse(x, y, r, r); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment