Created
October 15, 2014 16:22
-
-
Save jessicasarawilson/a4ef69616f377e9b8d60 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
int maxStarSize = 14; | |
ArrayList sparkleChars; | |
PImage img; | |
PImage sledge; | |
PImage brush; | |
void setup() { | |
size(1100, 600, P3D); | |
img = loadImage ("mouth.png"); | |
sledge = loadImage ("Sledgehammer.png"); | |
sledge.resize(100, 50); | |
brush = loadImage ("brush.png"); | |
brush.resize(100, 50); | |
noStroke(); | |
fill(204); | |
sphereDetail(60); | |
sparkleChars = new ArrayList(); // Create an empty ArrayList | |
for( int i = 0; i< 80; i++) // now add some elements for initial seeding | |
CreateChar(1); | |
} | |
void draw(){ | |
background(255, 120, 140, 3); | |
tint(255, 150); | |
image(img, 0, 0); | |
if (!mousePressed) { | |
image(sledge, mouseX-sledge.width/2, mouseY-sledge.height/2); } | |
else { image(brush, mouseX-brush.width/2, mouseY-brush.height/2); } | |
frameRate(500); | |
for (int i = sparkleChars.size()-2; i >= 0; i--){ | |
Sparkle s = (Sparkle) sparkleChars.get(i); | |
if (s.notVisible() ) sparkleChars.remove(i); | |
else | |
{ | |
s.shrink(); | |
s.display(); | |
} | |
} | |
if ((frameCount & 2) >= 0 ) | |
{ | |
int x = (int)random(8); | |
for (int j = 0; j < x; j++) | |
{ | |
CreateChar(1); | |
CreateChar(4); // top 1/4th | |
} | |
} | |
} | |
void mouseDragged() { | |
image(brush, mouseX-brush.width/2, mouseY-brush.height/2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment