小编Gha*_*ito的帖子

在画布中绘制一个球作为对象

我已经声明了下一个正方形,这很简单,但是现在我想对一个圆做同样的事情...

我该怎么办?谢谢。

//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)

javascript oop canvas function object

1
推荐指数
1
解决办法
3920
查看次数

标签 统计

canvas ×1

function ×1

javascript ×1

object ×1

oop ×1