Created
September 14, 2012 19:42
-
-
Save lizkhoo/3724241 to your computer and use it in GitHub Desktop.
Play with Miley's Hair
This file contains hidden or 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
| /*Liz Khoo - ICM - Revised Face Drawing*/ | |
| float bangsX=120; | |
| float bangsY=200; | |
| float haircolorH=53; | |
| float haircolorS=29; | |
| float haircolorB=99; | |
| float x=0; | |
| float y=0; | |
| void setup(){ | |
| size(500,400); | |
| colorMode(HSB,370,110,110); //Default ranges for HSB | |
| background(302,22,90); | |
| smooth(); | |
| noStroke(); | |
| //background 20 dots across by 11 dots down; 35 px squares, middle pt is 17.5px | |
| //width of dot is 20 px | |
| //colors of dot are randomized HSB | |
| for(x = 0; x < width; x+=17.5){ | |
| for (y = 0; y < height; y+=17.5){ | |
| float h= random(370); | |
| float s= random(110); | |
| float b= random(110); | |
| fill(h,s,b); | |
| ellipse(x,y,11,11); | |
| } | |
| } | |
| fill(0,0,110); | |
| text("click and drag mouse to change Miley's hair!",20,380); | |
| } | |
| //face shape | |
| void draw(){ | |
| fill(34,97,74); | |
| noStroke(); | |
| ellipse(250,200,175,310); | |
| //hair | |
| fill(haircolorH,haircolorS,haircolorB); | |
| rect(150,30,200,140); | |
| triangle(320,20,248,200,bangsX,bangsY); | |
| //eyes | |
| fill(227,90,99); | |
| ellipse(220,230,21,21); | |
| ellipse(279,230,21,21); | |
| //mouth | |
| stroke(317,80,97); | |
| strokeWeight(5); | |
| line(220,300,279,300); | |
| } | |
| void mouseDragged(){ | |
| bangsX=mouseX; | |
| bangsY=mouseY; | |
| haircolorH=random(370); | |
| haircolorS=random(110); | |
| haircolorB=random(110); | |
| } | |
| void keyPressed(){ | |
| background(302,22,90); | |
| noStroke(); | |
| for(x = 0; x < width; x+=17.5){ | |
| for (y = 0; y < height; y+=17.5){ | |
| float h= random(370); | |
| float s= random(110); | |
| float b= random(110); | |
| fill(h,s,b); | |
| ellipse(x,y,11,11); | |
| } | |
| } | |
| fill(0,0,110); | |
| text("hit any key to reset",20,380); | |
| fill(haircolorH,haircolorS,haircolorB); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment