alecmce-primitivesjs
Version:
A small library for visualizing the prime factor decomposition of numbers.
39 lines (38 loc) • 1.31 kB
JavaScript
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var ANGLE = Math.PI / 3;
var Seven = (function () {
function Seven(drawCircle, color, padding, child) {
this.drawCircle = drawCircle;
this.color = color;
this.padding = padding;
this.child = child;
this.offset = 2 * child.radius + padding;
this.radius = this.offset + child.radius + padding;
}
Seven.prototype.draw = function (config) {
var container = this.drawCircle(__assign({}, config, { radius: this.radius, color: this.color, stroke: true }));
this.child.draw({
container: container,
x: 0,
y: 0,
});
for (var i = 0; i < 6; ++i) {
var angle = ANGLE * i;
var x = this.offset * Math.sin(angle);
var y = this.offset * Math.cos(angle);
this.child.draw({ container: container, x: x, y: y });
}
return container;
};
return Seven;
}());
exports.Seven = Seven;
;