我已经声明了下一个正方形,这很简单,但是现在我想对一个圆做同样的事情...
我该怎么办?谢谢。
//Create Var
var squa = new Square(320, 380, 50, 50);
//Define the square
function Square(x, y, width, height) {
"use strict";
this.x = (x === null) ? 0 : x;
this.y = (y === null) ? 0 : y;
this.width = (width === null) ? 0 : width;
this.height = (height === null) ? this.width : height;
}
//Draw the square as object
squa.fill(ctx);
Run Code Online (Sandbox Code Playgroud)