drawing - How do I draw a simple stickman with javascript? -
function setup(){ = 5; } function draw(){ background(0,0,0); if (a == 5) { fill(255,255,255); ellipse(250,150,100,100); fill(255,255,255); rect(245,199,10,160); fill(255,255,255); rect(150,199,200,10); } if (a == 6) { fill(250,189,65); ellipse(250,250,100,100); fill(178,102,255); ellipse(250,250,500,100); } } function keytyped() { = 5; } if (key == 'f') { = 6; } }
^ above javascript (sketch.js), html
<!doctype html> <html> <head> <body> </body> </html>
this have far, , it's showing head, arms , body, can't find way make diagonal lines / or arc legs
edit: pasted full code- i'm looking find simplest approach creating arched line?
you can try this:
function setup(){ createcanvas(500,500); // initialize a, assign value 5 = 5; } function draw(){ background(0,0,0); fill(255,255,255); text("m stickman, f flower",10,30); if (a == 5) { ellipsemode (center); ellipse (150,60,50,50); point (140,60); point (160,60); rectmode (center); rect (150,135,50,100); line (125,85,100,160); line (175,85,200,160); line (130,185,130,250); line (130,250,125,250); line (170,185,170,250); line (170,250,175,250); }
Comments
Post a Comment