🎃
This program uses the width
and height
variables to draw a Jack-o’-lantern that changes size according to the window size.
size(200, 200);
//stem
stroke(0, 100, 0);
strokeWeight(10);
line(width/2, height/4, width*.6, height*.15);
//pumpkin
strokeWeight(2);
fill(255, 100, 0);
stroke(120, 60, 0);
ellipse(width/2, height/2, width*.75, height/2);
ellipse(width/2, height/2, width*.625, height/2);
ellipse(width/2, height/2, width*.5, height/2);
ellipse(width/2, height/2, width*.375, height/2);
ellipse(width/2, height/2, width*.25, height/2);
ellipse(width/2, height/2, width*.125, height/2);
//eyes
fill(0);
triangle(width*.4, height*.35, width*.35, height*.45, width*.45, height*.45);
triangle(width*.6, height*.35, width*.55, height*.45, width*.65, height*.45);
//mouth
arc(width*.5, height*.65, width*.4, height*.2, 3.14, 2*3.14);
line(width*.3, height*.65, width*.7, height*.65);
See the Pen by Happy Coding (@KevinWorkman) on CodePen.
Try changing the parmaters passed into the size()
function to change the size of the window, and the size of the Jack-o’-lantern will change automatically.
🎃 🎃
Use Processing to draw a Jack-o'-lantern!
Happy Coding is a community of folks just like you learning about coding.
Do you have a comment or question? Post it here!
Comments are powered by the Happy Coding forum. This page has a corresponding forum post, and replies to that post show up as comments here. Click the button above to go to the forum to post a comment!