2023-02-17 11:06:01 +01:00

41 lines
1.5 KiB
JavaScript

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CircleDrawer = void 0;
class CircleDrawer {
draw(context, particle, radius) {
if (!particle.circleRange) {
particle.circleRange = { min: 0, max: Math.PI * 2 };
}
const circleRange = particle.circleRange;
context.arc(0, 0, radius, circleRange.min, circleRange.max, false);
}
getSidesCount() {
return 12;
}
particleInit(container, particle) {
var _a;
const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
max: 360,
min: 0,
};
particle.circleRange =
typeof angle !== "object"
? {
min: 0,
max: (angle * Math.PI) / 180,
}
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
}
}
exports.CircleDrawer = CircleDrawer;
});