import * as three from "three-js"; import { factor } from "./factor.js"; 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.mesh); } } } export { functional_factor };