Created
April 13, 2019 13:36
-
-
Save xlimit91/0bf6ed7e720f24afd621cc6abc57f3e5 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
// https://editor.p5js.org/ | |
function setup() { | |
createCanvas(500, 500); | |
} | |
function draw() { | |
background(255, 192, 203); | |
//eyes | |
fill('white'); | |
circle(100, 100, 90); | |
circle(400, 100, 90); | |
//eyes blue | |
fill('blue'); | |
circle(100, 150, 30); | |
circle(380, 120, 30); | |
//eyes black and nose | |
fill('black'); | |
circle(250, 200, 10); | |
circle(100, 160, 6); | |
circle(380, 110, 8); | |
// mouth black | |
rect(100, 250, 300, 100, 50); | |
//draw tongue | |
tongueDraw(touchTheTongue()); | |
} | |
// tongue shaking | |
function tongueDraw(tongueT) { | |
fill('red'); | |
if (tongueT == true) { | |
rect(200 + Math.floor(Math.random() * 50), 300 + Math.floor(Math.random() * 10), 70, 180, 50); | |
} else { | |
rect(200, 300, 70, 180, 50); | |
} | |
} | |
// touch the tongue | |
function touchTheTongue() { | |
if (mouseY <= 280) { | |
return false; | |
} else { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment