저는 세 줄을 그려서 두 번째와 세 번째 줄의 무게를 바꾸고 두 번째와 세 번째 줄을 채색하려고합니다. 나는 모든 일을 제대로하고 있다고 생각하지만 일이 잘되지 않습니다. 선 대신 정점을 사용하고 있지만 코드가 올바르게 작동하지 않습니다. 색상이 없습니다. 도움 주셔서 감사합니다. 나는 그것이 무언가다는 것을 확실하다 벙어리 나는 분실하고있다.3 개의 꼭지점을 색칠하려고합니다.
//write the code to draw 3 lines
//
//set the area size
size(100,200);
//
smooth(); //not needed for lines but there for comment
background(#FCFDFF); //go white
//line(x1,y1,x2,y2);
//but doesn't work to for fill color. Use vertex
//vertex(x, y)
//x float: x-coordinate of the vertex
//y float: y-coordinate of the vertex
//z float: z-coordinate of the vertex
//
//set stroke using strokeWeight
//draw first line with a stroke weight of 3
beginShape(LINES);
background(#FFFFFF);
strokeWeight(3);
vertex(20, 30);
vertex(20, 90);
//
//draw second line with stroke weight of 5 and color it RED
//second line
strokeWeight(5);
fill(255,0,0);
vertex(40, 30);
vertex(40, 90);
//
//draw third line with rounded ends and stroke weight
//of 7 and PURPLE
//
strokeWeight(7);
strokeJoin(ROUND);
fill(#C811F2);
vertex(60, 30);
vertex(60, 90);
endShape();
//end of program
//NEW code I wrote -
size(100,200);
background(#FCFDFF); //go white
//draw 3 lines
//line(x1,y1,x2,y2);
//but doesn't work to fill color. Use vertex and stroke();
//vertex(x, y)
//x float: x-coordinate of the vertex
//y float: y-coordinate of the vertex
//z float: z-coordinate of the vertex
//set stroke using strokeWeight
//draw first line with a stroke weight of 3
//noStroke();
beginShape(LINES);
background(#FFFFFF);
//
strokeWeight(3);
vertex(20, 30); //top
vertex(20, 90); //bottom
//
//draw second line with stroke weight of 5 and RED
//
stroke(255,0,0);
strokeWeight(5);
vertex(40, 30); //top
vertex(40, 90); //bottom
//
//draw third line with rounded ends and stroke weight
//of 7 and PURPLE
//
stroke(#C40FD8);
strokeWeight(7);
strokeJoin(ROUND);
vertex(60, 30); //top
vertex(60, 90); //bottom
endShape();
//end of program
을 사용하지 잊어 버렸습니다. 나는 제 2의 '선'을 끝까지 제곱 할 수 있도록 수정해야한다. – Waynewal
도움말을 잊어서 고맙습니다. 내 메일은이 대답을 잡지 못했습니다. 귀하의 제안은 아주 잘 진행되었습니다. 지연 돼서 죄송합니다. – Waynewal