function Figure(x,y,color) { this.x = x; this.y = y; this.color = color; }; function Circle(x,y,r,color) { Figure.call(this,x,y,color); this.draw = function() { var canvas = document.getElementById("canvasID"), ctx = canvas.getContext("2d"); // ctx.strokeStyle = "#000"; - граница ctx.fillStyle = color; ctx.beginPath(); ctx.arc(x, y, r, 0, Math.PI*2, true); ctx.closePath(); // ctx.stroke(); ctx.fill(); }; }; function Canvas() { this.add = function() { } }; //------------------// // var line = new Line(50, 250, 200, 200, 'red'); // x1, y1, x2, y2, color var circle = new Circle(120, 100, 50, 'green'); // x, y, r, color circle.draw(); // var rect = new Rect(260, 130, 60, 120, 'blue'); // x, y, w, h, color