import * as three from "three-js"; class factor { #mesh; constructor(mesh) { if (!(mesh instanceof three.Object3D)) { throw new TypeError("Must initialize with Object3D."); } this.#mesh = mesh; } get mesh() { return this.#mesh; } loop() { return null; } } class functional_factor extends factor { #animation; constructor (init, animation = null) { if (typeof(init) !== "function") { throw new TypeError("Init must be an function."); } if (animation !== null && typeof(animation) !== "function") { throw new TypeError("Animation could only be null or function."); } const mesh = init(); if (!(mesh instanceof three.Object3D)) { throw new TypeError("Factor initializer must return Object3D."); } super(mesh); this.#animation = animation; } loop() { if (this.#animation !== null) { this.#animation(this); } } } export { factor, functional_factor }