Rysowanie wielokąta nieregularnego (2)
Klasa używa skryptu figures.js
Listing
var cv = document.getElementById("canvas"); var ctx = cv.getContext("2d"); var points = new IrregPolygon(new Point(120, 20), new Point(170, 70), new Point(210, 60), new Point(190, 110), new Point(240, 140), new Point(180, 180), new Point(80, 200), new Point(60, 150), new Point(130, 50)); points.fillStyle = "red"; points.strokeStyle = "blue"; //points.fill = true; points.stroke = true; points.lineWidth = 5; points.draw(ctx); // var points1 = points.deepclone(); ctx.translate(200,0); points1.draw(ctx);