Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@xlimit91
Created April 13, 2019 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlimit91/0bf6ed7e720f24afd621cc6abc57f3e5 to your computer and use it in GitHub Desktop.
Save xlimit91/0bf6ed7e720f24afd621cc6abc57f3e5 to your computer and use it in GitHub Desktop.
// 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