爱上Processing学习笔记
常见图形画法:
画直线: line(x1, y1, x2, y2)
三角形: triangle(x1, y1, x2, y2, x3, y3)
四边形: quad(x1, y1, x2, y2, x3, y3, x4, y4)
矩形: rect(x, y, width, height)
圆形: ellipse(x, y, width, height)
扇形: arc(x, y, width, height, start, stop) //第五个参数设置开始圆弧的角度,第六个是结束的角度。角度是弧度制的,可以使用PI, QUARTER_PI, HALF_PI, TWO_PI
1 size(720, 480); 2 smooth(); 3 strokeWeight(2); 4 background(204); 5 ellipseMode(RADIUS); 6 7 stroke(102); 8 line(266, 257, 266, 162); 9 line(276, 257, 276, 162); 10 line(286, 257, 286, 162); 11 12 line(276, 155, 246, 112); 13 line(276, 155, 306, 56); 14 line(276, 155, 342, 170); 15 16 noStroke(); 17 fill(102); 18 ellipse(264, 377, 33, 33); 19 fill(0); 20 rect(219, 257, 90, 120); 21 fill(102); 22 rect(219, 274, 90, 6); 23 24 fill(0); 25 ellipse(276, 155, 45, 45); 26 fill(255); 27 ellipse(288, 150, 14, 14); 28 fill(0); 29 ellipse(288, 150, 3, 3); 30 fill(153); 31 ellipse(263, 148, 5, 5); 32 ellipse(296, 130, 4, 4); 33 ellipse(305, 162, 3, 3);