function setup(){
a = 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()
{
a = 5;
}
if (key == 'f')
{
a = 6;
}
}
^ 上面是javascript(sketch.js),HTML只是
<!DOCTYPE html>
<html>
<head>
<body>
</body>
</html>
这是我到目前为止所做的,而且它只显示头部,手臂和身体,我无法找到一条方法为腿部做出斜线/或弧线
编辑:我刚刚粘贴了完整的代码 - 我想找到最简单的方法来创建拱形线?
答案 0 :(得分:0)
你可以试试这个:
function setup(){
createCanvas(500,500);
// initialize a, assign the value 5 to a
a = 5;
}
function draw(){
background(0,0,0);
fill(255,255,255);
text("M for Stickman, F for 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);
}