@tdurtschi/bug
Version:
Bug is a simulation that models a weevil walking around in an HTML canvas.
28 lines • 831 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.horizLine = exports.circle = exports.clearCanvas = exports.fixY = void 0;
function fixY(height, y) {
return height - y;
}
exports.fixY = fixY;
exports.clearCanvas = function (ctx) {
ctx.canvas;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.beginPath();
};
exports.circle = function (ctx, size) {
ctx.beginPath();
ctx.fillStyle = "rgb(0, 0, 255)";
ctx.arc(0, 0, size, 0, 2 * Math.PI, false);
ctx.fill();
};
function horizLine(ctx, length) {
ctx.beginPath();
ctx.fillStyle = "rgb(0, 0, 255)";
ctx.moveTo(0, 0);
ctx.lineTo(length, 0);
ctx.stroke();
}
exports.horizLine = horizLine;
//# sourceMappingURL=canvas-helpers.js.map