Skip to content

Instantly share code, notes, and snippets.

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 extrajordanary/22d469400c2842883d2360acb76c9e1c to your computer and use it in GitHub Desktop.
Save extrajordanary/22d469400c2842883d2360acb76c9e1c to your computer and use it in GitHub Desktop.
sayema_shapes_colors_challenge.js
function setup () {
createCanvas(500, 500);
}
function draw () {
background(230, 230, 255);
// #2 Draw 2 creatures
// Creature 1: Cat
//Paws
stroke(255);
fill(155);
ellipse(285, 455, 90, 20);
ellipse(265, 485, 70, 20);
stroke(0);
line(287, 483, 297, 483);
line(287, 487, 297, 487);
line(319, 457, 327, 457);
line(319, 453, 327, 453);
// Tail
stroke(255);
rect(30, 385, 20, 75, 20);
//Body
stroke(255);
ellipse(147, 463, 234, 100);
// Ear 1
stroke(255);
fill(155);
triangle(215, 370, 255, 315, 300, 370);
stroke(255);
fill(225, 175, 175);
triangle(245, 347, 255, 327, 265, 347);
// Nose
fill(0);
stroke(0);
ellipse(340, 395, 15, 15);
// Head
stroke(255);
fill(155);
ellipse(275, 400, 130, 130);
// Ear 2
triangle(270, 350, 310, 315, 325, 370);
// Whiskers
stroke(0);
line(300, 385, 330, 393);
line(300, 395, 330, 395);
line(300, 405, 330, 397);
//Creature 2: Butterfly
//Antennae
stroke(0);
noFill();
arc(403, 215, 4, 30, HALF_PI, PI);
arc(406, 215, 4, 30, 0, HALF_PI);
//Top Wings
noStroke();
fill(255, 185, 0);
ellipse(385, 247, 35, 47);
ellipse(425, 247, 35, 47);
//Bottom Wings
arc(425, 270, 37, 39, QUARTER_PI, PI + QUARTER_PI);
arc(385, 270, 37, 39, -QUARTER_PI, -PI - QUARTER_PI);
//Top Wings fill
fill(255, 230, 0);
ellipse(385, 247, 30, 42);
ellipse(425, 247, 30, 42);
//Bottom Wings fill
arc(425, 270, 31, 33, QUARTER_PI, PI + QUARTER_PI);
arc(385, 270, 31, 33, -QUARTER_PI, -PI - QUARTER_PI);
//Body
stroke(105, 35, 35);
fill(105, 35, 35);
ellipse(405, 235, 6, 11);
ellipse(405, 265, 7, 60);
//Clouds
stroke(255);
fill(255, 255, 255, 75);
ellipse (70, 30, 150, 100);
ellipse (170, 45, 150, 60);
ellipse (100, 70, 130, 85);
ellipse(470, 65, 300, 30);
ellipse(490, 50, 60, 20);
// Bonus Challenge
//Creature Labels
stroke(0, 0, 255);
textSize(20);
text('cat', 319, 486);
text('butterfly', 372, 323);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment