@urpflanze/js
Version:
A library for developers who want to approach to creative coding, artists who want to approach coding and for those who find it fun to play with math.
1,115 lines (1,063 loc) • 1.36 MB
JavaScript
/*!
* @license UrpflanzeJS v"1.1.5"
* urpflanze.js
*
* Github: https://github.com/urpflanze-org/urpflanze
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* Core: ^0.5.9 | DrawerCanvas: ^0.3.1
*/
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Animation": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Animation),
/* harmony export */ "Circle": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Circle),
/* harmony export */ "DrawerCanvas": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.DrawerCanvas),
/* harmony export */ "Group": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Group),
/* harmony export */ "Line": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Line),
/* harmony export */ "Lissajous": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Lissajous),
/* harmony export */ "Modifier": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Modifier),
/* harmony export */ "Modifiers": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Modifiers),
/* harmony export */ "PHI": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.PHI),
/* harmony export */ "PI2": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.PI2),
/* harmony export */ "Polygon": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Polygon),
/* harmony export */ "Rect": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Rect),
/* harmony export */ "Rose": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Rose),
/* harmony export */ "Scene": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Scene),
/* harmony export */ "SceneChild": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.SceneChild),
/* harmony export */ "Shape": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Shape),
/* harmony export */ "ShapeBase": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapeBase),
/* harmony export */ "ShapeBuffer": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapeBuffer),
/* harmony export */ "ShapeFollow": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapeFollow),
/* harmony export */ "ShapeLoop": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapeLoop),
/* harmony export */ "ShapePrimitive": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapePrimitive),
/* harmony export */ "ShapeRecursive": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.ShapeRecursive),
/* harmony export */ "Spiral": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Spiral),
/* harmony export */ "Star": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Star),
/* harmony export */ "SuperShape": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.SuperShape),
/* harmony export */ "Triangle": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Triangle),
/* harmony export */ "Vec2": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.Vec2),
/* harmony export */ "__esModule": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.__esModule),
/* harmony export */ "angle2FromRepetition": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.angle2FromRepetition),
/* harmony export */ "angleFromRepetition": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.angleFromRepetition),
/* harmony export */ "clamp": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.clamp),
/* harmony export */ "distanceFromRepetition": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.distanceFromRepetition),
/* harmony export */ "distributePointsInBuffer": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.distributePointsInBuffer),
/* harmony export */ "interpolate": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.interpolate),
/* harmony export */ "lerp": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.lerp),
/* harmony export */ "log": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.log),
/* harmony export */ "mod": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.mod),
/* harmony export */ "noise": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.noise),
/* harmony export */ "now": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.now),
/* harmony export */ "prepareBufferForInterpolation": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.prepareBufferForInterpolation),
/* harmony export */ "random": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.random),
/* harmony export */ "relativeClamp": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.relativeClamp),
/* harmony export */ "toDegrees": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.toDegrees),
/* harmony export */ "toRadians": () => (/* reexport safe */ _modules_light__WEBPACK_IMPORTED_MODULE_0__.toRadians),
/* harmony export */ "Color": () => (/* reexport module object */ _urpflanze_color_dist_cjs__WEBPACK_IMPORTED_MODULE_1__),
/* harmony export */ "Renderer": () => (/* reexport safe */ _urpflanze_drawer_canvas_dist_cjs__WEBPACK_IMPORTED_MODULE_2__.Renderer),
/* harmony export */ "Timeline": () => (/* reexport safe */ _urpflanze_drawer_canvas_dist_cjs__WEBPACK_IMPORTED_MODULE_2__.Timeline),
/* harmony export */ "GCODEExporter": () => (/* reexport safe */ _urpflanze_gcode_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_3__.GCODEExporter),
/* harmony export */ "SVGExporter": () => (/* reexport safe */ _urpflanze_svg_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_4__.SVGExporter),
/* harmony export */ "SVGImporter": () => (/* reexport safe */ _urpflanze_svg_importer__WEBPACK_IMPORTED_MODULE_5__.SVGImporter)
/* harmony export */ });
/* harmony import */ var _modules_light__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var _urpflanze_color_dist_cjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75);
/* harmony import */ var _urpflanze_color_dist_cjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_color_dist_cjs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _urpflanze_drawer_canvas_dist_cjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80);
/* harmony import */ var _urpflanze_drawer_canvas_dist_cjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_drawer_canvas_dist_cjs__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _urpflanze_gcode_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97);
/* harmony import */ var _urpflanze_gcode_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_gcode_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _urpflanze_svg_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(102);
/* harmony import */ var _urpflanze_svg_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_svg_exporter_dist_cjs__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _urpflanze_svg_importer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(109);
/* harmony import */ var _urpflanze_svg_importer__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_svg_importer__WEBPACK_IMPORTED_MODULE_5__);
//# sourceMappingURL=modules.js.map
/***/ }),
/* 2 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Circle": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Circle),
/* harmony export */ "Group": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Group),
/* harmony export */ "Line": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Line),
/* harmony export */ "Lissajous": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Lissajous),
/* harmony export */ "Modifier": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Modifier),
/* harmony export */ "Modifiers": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Modifiers),
/* harmony export */ "PHI": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.PHI),
/* harmony export */ "PI2": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.PI2),
/* harmony export */ "Polygon": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Polygon),
/* harmony export */ "Rect": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Rect),
/* harmony export */ "Rose": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Rose),
/* harmony export */ "Scene": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Scene),
/* harmony export */ "SceneChild": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.SceneChild),
/* harmony export */ "Shape": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Shape),
/* harmony export */ "ShapeBase": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapeBase),
/* harmony export */ "ShapeBuffer": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapeBuffer),
/* harmony export */ "ShapeFollow": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapeFollow),
/* harmony export */ "ShapeLoop": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapeLoop),
/* harmony export */ "ShapePrimitive": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapePrimitive),
/* harmony export */ "ShapeRecursive": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.ShapeRecursive),
/* harmony export */ "Spiral": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Spiral),
/* harmony export */ "Star": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Star),
/* harmony export */ "SuperShape": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.SuperShape),
/* harmony export */ "Triangle": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Triangle),
/* harmony export */ "Vec2": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.Vec2),
/* harmony export */ "__esModule": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.__esModule),
/* harmony export */ "angle2FromRepetition": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.angle2FromRepetition),
/* harmony export */ "angleFromRepetition": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.angleFromRepetition),
/* harmony export */ "clamp": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.clamp),
/* harmony export */ "distanceFromRepetition": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.distanceFromRepetition),
/* harmony export */ "distributePointsInBuffer": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.distributePointsInBuffer),
/* harmony export */ "interpolate": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.interpolate),
/* harmony export */ "lerp": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.lerp),
/* harmony export */ "log": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.log),
/* harmony export */ "mod": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.mod),
/* harmony export */ "noise": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.noise),
/* harmony export */ "now": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.now),
/* harmony export */ "prepareBufferForInterpolation": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.prepareBufferForInterpolation),
/* harmony export */ "random": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.random),
/* harmony export */ "relativeClamp": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.relativeClamp),
/* harmony export */ "toDegrees": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.toDegrees),
/* harmony export */ "toRadians": () => (/* reexport safe */ _core__WEBPACK_IMPORTED_MODULE_0__.toRadians),
/* harmony export */ "Animation": () => (/* reexport module object */ _urpflanze_animation_dist_cjs__WEBPACK_IMPORTED_MODULE_1__),
/* harmony export */ "DrawerCanvas": () => (/* reexport safe */ _urpflanze_drawer_canvas_dist_cjs_browser_BrowserDrawerCanvas__WEBPACK_IMPORTED_MODULE_2__.BrowserDrawerCanvas)
/* harmony export */ });
/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var _urpflanze_animation_dist_cjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58);
/* harmony import */ var _urpflanze_animation_dist_cjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_urpflanze_animation_dist_cjs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _urpflanze_drawer_canvas_dist_cjs_browser_BrowserDrawerCanvas__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68);
//# sourceMappingURL=modules-light.js.map
/***/ }),
/* 3 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Scene": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Scene__WEBPACK_IMPORTED_MODULE_0__.Scene),
/* harmony export */ "__esModule": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Scene__WEBPACK_IMPORTED_MODULE_0__.__esModule),
/* harmony export */ "SceneChild": () => (/* reexport safe */ _urpflanze_core_dist_cjs_SceneChild__WEBPACK_IMPORTED_MODULE_1__.SceneChild),
/* harmony export */ "Group": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Group__WEBPACK_IMPORTED_MODULE_2__.Group),
/* harmony export */ "ShapeBase": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapeBase__WEBPACK_IMPORTED_MODULE_3__.ShapeBase),
/* harmony export */ "ShapePrimitive": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapePrimitive__WEBPACK_IMPORTED_MODULE_4__.ShapePrimitive),
/* harmony export */ "ShapeLoop": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapeLoop__WEBPACK_IMPORTED_MODULE_5__.ShapeLoop),
/* harmony export */ "ShapeBuffer": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapeBuffer__WEBPACK_IMPORTED_MODULE_6__.ShapeBuffer),
/* harmony export */ "Shape": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_Shape__WEBPACK_IMPORTED_MODULE_7__.Shape),
/* harmony export */ "ShapeRecursive": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapeRecursive__WEBPACK_IMPORTED_MODULE_8__.ShapeRecursive),
/* harmony export */ "ShapeFollow": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_ShapeFollow__WEBPACK_IMPORTED_MODULE_9__.ShapeFollow),
/* harmony export */ "Line": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Line__WEBPACK_IMPORTED_MODULE_10__.Line),
/* harmony export */ "Triangle": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Triangle__WEBPACK_IMPORTED_MODULE_11__.Triangle),
/* harmony export */ "Rect": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Rect__WEBPACK_IMPORTED_MODULE_12__.Rect),
/* harmony export */ "Polygon": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Polygon__WEBPACK_IMPORTED_MODULE_13__.Polygon),
/* harmony export */ "Circle": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Circle__WEBPACK_IMPORTED_MODULE_14__.Circle),
/* harmony export */ "Star": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Star__WEBPACK_IMPORTED_MODULE_15__.Star),
/* harmony export */ "Rose": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Rose__WEBPACK_IMPORTED_MODULE_16__.Rose),
/* harmony export */ "Spiral": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Spiral__WEBPACK_IMPORTED_MODULE_17__.Spiral),
/* harmony export */ "Lissajous": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_Lissajous__WEBPACK_IMPORTED_MODULE_18__.Lissajous),
/* harmony export */ "SuperShape": () => (/* reexport safe */ _urpflanze_core_dist_cjs_shapes_primitives_SuperShape__WEBPACK_IMPORTED_MODULE_19__.SuperShape),
/* harmony export */ "Modifier": () => (/* reexport safe */ _urpflanze_core_dist_cjs_modifiers_Modifier__WEBPACK_IMPORTED_MODULE_20__.Modifier),
/* harmony export */ "Modifiers": () => (/* reexport safe */ _urpflanze_core_dist_cjs_modifiers__WEBPACK_IMPORTED_MODULE_21__.Modifiers),
/* harmony export */ "lerp": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.lerp),
/* harmony export */ "clamp": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.clamp),
/* harmony export */ "relativeClamp": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.relativeClamp),
/* harmony export */ "toDegrees": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.toDegrees),
/* harmony export */ "toRadians": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.toRadians),
/* harmony export */ "now": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.now),
/* harmony export */ "noise": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.noise),
/* harmony export */ "random": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.random),
/* harmony export */ "angleFromRepetition": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.angleFromRepetition),
/* harmony export */ "angle2FromRepetition": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.angle2FromRepetition),
/* harmony export */ "distanceFromRepetition": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.distanceFromRepetition),
/* harmony export */ "interpolate": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.interpolate),
/* harmony export */ "prepareBufferForInterpolation": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.prepareBufferForInterpolation),
/* harmony export */ "distributePointsInBuffer": () => (/* reexport safe */ _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__.distributePointsInBuffer),
/* harmony export */ "Vec2": () => (/* reexport safe */ _urpflanze_core_dist_cjs_math_Vec2__WEBPACK_IMPORTED_MODULE_23__["default"]),
/* harmony export */ "PHI": () => (/* reexport safe */ _urpflanze_core_dist_cjs_math__WEBPACK_IMPORTED_MODULE_24__.PHI),
/* harmony export */ "PI2": () => (/* reexport safe */ _urpflanze_core_dist_cjs_math__WEBPACK_IMPORTED_MODULE_24__.PI2),
/* harmony export */ "log": () => (/* reexport safe */ _urpflanze_core_dist_cjs_math__WEBPACK_IMPORTED_MODULE_24__.log),
/* harmony export */ "mod": () => (/* reexport safe */ _urpflanze_core_dist_cjs_math__WEBPACK_IMPORTED_MODULE_24__.mod)
/* harmony export */ });
/* harmony import */ var _urpflanze_core_dist_cjs_Scene__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var _urpflanze_core_dist_cjs_SceneChild__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
/* harmony import */ var _urpflanze_core_dist_cjs_Group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapeBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapePrimitive__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapeLoop__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(37);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapeBuffer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_Shape__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(35);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapeRecursive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(39);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_ShapeFollow__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(40);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Line__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(41);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Triangle__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Rect__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(43);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Polygon__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(44);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Circle__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(45);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Star__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(46);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Rose__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(47);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Spiral__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(48);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_Lissajous__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(49);
/* harmony import */ var _urpflanze_core_dist_cjs_shapes_primitives_SuperShape__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(50);
/* harmony import */ var _urpflanze_core_dist_cjs_modifiers_Modifier__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(32);
/* harmony import */ var _urpflanze_core_dist_cjs_modifiers__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(51);
/* harmony import */ var _urpflanze_core_dist_cjs_Utilities__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(33);
/* harmony import */ var _urpflanze_core_dist_cjs_math_Vec2__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(29);
/* harmony import */ var _urpflanze_core_dist_cjs_math__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(30);
//# sourceMappingURL=core.js.map
/***/ }),
/* 4 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Scene = void 0;
const SceneChild_1 = __webpack_require__(5);
const Group_1 = __webpack_require__(6);
const Shape_1 = __webpack_require__(35);
const Utilities_1 = __webpack_require__(33);
/**
* Container for all SceneChild.
* The main purpose is to manage the drawing order and update the child buffers
*
* @order 1
* @category Scene
* @class Scene
*/
class Scene {
/**
* Creates an instance of Scene.
* You can see the default values in the property definitions
*/
constructor(settings = {}) {
/**
* Logical number, the drawer will take care of defining the unit of measure
*/
this.width = 400;
/**
* Logical number, the drawer will take care of defining the unit of measure
*/
this.height = 400;
/**
* Default background color (black)
*/
this.background = 'hsla(0, 0%, 0%, 1)';
/**
* Default ScenePrimitive stroke color (white)
*/
this.color = 'hsla(0, 0%, 100%, 1)';
/**
* Current time
*/
this.currentTime = 0;
if (typeof settings.width !== 'undefined')
this.width = settings.width;
if (typeof settings.height !== 'undefined')
this.height = settings.height;
if (typeof settings.background !== 'undefined')
this.background = settings.background;
if (typeof settings.color !== 'undefined')
this.color = settings.color;
this.children = [];
this.anchorSettings = settings.anchor;
this.setSize(settings.width || this.width, settings.height || this.height, settings.anchor);
}
/**
* set scene size, center and anchor
*
* @private
* @param {number} width
* @param {number} height
* @param {(['left' | 'right' | 'center' | number, 'top' | 'bottom' | 'center' | number])} [anchor]
*/
setSize(width, height, anchor) {
this.width = width;
this.height = height;
this.center = [this.width / 2, this.height / 2];
this.anchor =
anchor && Array.isArray(anchor)
? [
typeof anchor[0] === 'number'
? (0.5 + Utilities_1.clamp(-1, 1, anchor[0]) * 0.5) * this.width
: anchor[0] === 'left'
? 0
: anchor[0] === 'right'
? this.width
: this.center[0],
typeof anchor[1] === 'number'
? (0.5 + Utilities_1.clamp(-1, 1, anchor[1]) * 0.5) * this.height
: anchor[1] === 'top'
? 0
: anchor[1] === 'bottom'
? this.height
: this.center[1],
]
: [this.center[0], this.center[1]];
}
/**
* Return width percentage
*
* @param {number} [percentage=100]
* @returns {number}
*/
getWidth(percentage = 100) {
return (this.width * percentage) / 100;
}
/**
* Return height percentage
*
* @param {number} [percentage=100]
* @returns {number}
*/
getHeight(percentage = 100) {
return (this.height * percentage) / 100;
}
/**
* Resize the scene size
*
* @param {number} width
* @param {number} [height=width]
* @memberof Scene
*/
resize(width, height = width) {
this.setSize(width, height, this.anchorSettings);
this.children.forEach(sceneChild => sceneChild.clearBuffer(true, false));
}
/**
* Update all children, generate a streamable buffer for drawing
*
* @param {number} [atTime] time in ms
* @memberof Scene
*/
update(atTime = 0) {
this.currentTime = atTime;
for (let i = 0, len = this.children.length; i < len; i++) {
this.children[i].generate(this.currentTime, true);
}
}
/**
* Traverse the child buffer and use it with callback
*
* @param {(streamArguments: IStreamArguments) => void} callback
* @memberof Scene
*/
stream(callback) {
this.children.forEach(sceneChild => sceneChild.stream(callback));
}
/*
|--------------------------------------------------------------------------
| SceneChild
|--------------------------------------------------------------------------
*/
/**
* Return a list of children
*
* @returns {Array<SceneChild>}
* @memberof Scene
*/
getChildren() {
return this.children;
}
/**
* Add SceneChild to Scene, pass `order` as last parameter for drawing priorities
*
* @param {Array<SceneChild>} items
* @param {number} [order]
* @memberof Scene
*/
add(...items /**, order: number */) {
const order = typeof items[items.length - 1] === 'number' ? items[items.length - 1] : undefined;
const len = items.length - (typeof order === 'undefined' ? 0 : 1);
for (let i = 0; i < len; i++) {
const item = items[i];
item.order =
typeof order !== 'undefined'
? order + i
: typeof item.order !== 'undefined'
? item.order
: this.children.length > 0
? Math.max.apply(this, this.children.map(e => e.order || 0)) + 1
: 0;
Scene.propagateToChilden(item, this);
this.children.push(item);
item.clearBuffer(true, false);
item.generate(0, true);
}
this.sortChildren();
}
/**
* Sort children by order
*
* @memberof Scene
*/
sortChildren() {
this.children.sort((a, b) => a.order - b.order);
this.children = this.children.map((child, index) => {
child.order = index;
return child;
});
}
/**
* Find sceneChild from id or name in the whole scene
*
* @param {string | number} idOrName
* @returns {(SceneChild | null)}
* @memberof Scene
*/
find(idOrName) {
const children = this.getChildren();
for (let i = 0, len = children.length; i < len; i++) {
const result = children[i].find(idOrName);
if (result !== null)
return result;
}
return null;
}
/**
* Get shape by index
*
* @param {number} index
* @returns {(SceneChild | null)}
* @memberof Scene
*/
get(index) {
return index >= 0 && index < this.children.length ? this.children[index] : null;
}
/**
* Remove a shape by index
*
* @param {number} index
* @memberof Scene
*/
remove(index) {
index >= 0 && index < this.children.length && this.children.splice(index, 1);
}
/**
* Removes all children
*
* @memberof Scene
*/
removeChildren() {
this.children = [];
}
/**
* Remove sceneChild by id or name
*
* @param {number | number} idOrName
* @memberof Scene
*/
removeFromId(idOrName) {
for (let i = 0, len = this.children.length; i < len; i++)
if (this.children[i].id === idOrName || this.children[i].name === idOrName) {
this.children.splice(i, 1);
return;
}
}
/**
* Return true if sceneChild is direct children
*
* @param {SceneChild} sceneChild
* @returns {boolean}
* @memberof Scene
*/
isFirstLevelChild(sceneChild) {
for (let i = 0, len = this.children.length; i < len; i++)
if (this.children[i].id === sceneChild.id)
return true;
const parents = this.getParentsOfSceneChild(sceneChild);
return parents.length === 1 && parents[0] instanceof Group_1.Group;
}
/**
* Returns the list of sceneChild hierarchy starting from the scene
*
* @param {SceneChild} sceneChild
* @returns {Array<SceneChild>}
* @memberof Scene
*/
getParentsOfSceneChild(sceneChild) {
const result = Scene.getParentsOfSceneChild(this, sceneChild);
if (result) {
result.splice(0, 1);
return result;
}
return [];
}
/**
* Returns the list of sceneChild hierarchy starting from the scene
*
* @static
* @param {(Scene | SceneChild)} current
* @param {SceneChild} sceneChild
* @param {(Array<SceneChild | Scene>)} [parents=[]]
* @returns {(Array<SceneChild | Scene> | null)}
* @memberof Scene
*/
static getParentsOfSceneChild(current, sceneChild, parents = []) {
let result;
if (current instanceof SceneChild_1.SceneChild) {
if (current.id == sceneChild.id)
return parents;
if (current instanceof Shape_1.Shape && current.shape) {
const tmpParents = parents.slice();
tmpParents.push(current);
if ((result = Scene.getParentsOfSceneChild(current.shape, sceneChild, tmpParents)))
return result;
}
}
if (current instanceof Scene || current instanceof Group_1.Group) {
const children = current.getChildren();
parents.push(current);
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
if ((result = Scene.getParentsOfSceneChild(child, sceneChild, parents)))
return result;
}
parents.pop();
}
return null;
}
/**
* Walk through the scene
*
* @static
* @param {SceneChild} callbackk
* @param {(Scene | SceneChild)} current
* @memberof Scene
*/
static walk(callback, current) {
if (current instanceof SceneChild_1.SceneChild) {
if (callback(current) === false)
return false;
if (current instanceof Shape_1.Shape && current.shape)
if (Scene.walk(callback, current.shape) === false)
return false;
}
if (current instanceof Scene || current instanceof Group_1.Group) {
const children = current.getChildren();
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
if (Scene.walk(callback, child) === false)
return false;
}
}
}
/**
* Propagate scene to sceneChild (and children)
*
* @static
* @param {SceneChild} sceneChild
* @param {Scene} scene
* @memberof Scene
*/
static propagateToChilden(sceneChild, scene) {
sceneChild.scene = scene;
if (sceneChild instanceof Group_1.Group) {
sceneChild.getChildren().forEach((item) => {
Scene.propagateToChilden(item, scene);
});
}
else if (sceneChild instanceof Shape_1.Shape && sceneChild.shape) {
sceneChild.shape.scene = scene;
Scene.propagateToChilden(sceneChild.shape, scene);
}
}
}
exports.Scene = Scene;
//# sourceMappingURL=Scene.js.map
/***/ }),
/* 5 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SceneChild = void 0;
/**
* Autoincrement sceneChild default id
*
* @internal
* @ignore
*/
let __id = 0;
/**
* The element to be added into a scene.
* Preserve props, drawing order, generate and return buffers.
* The only implementations of this class are <a href="[base_url]/Group">Group</a> and <a href="[base_url]/ShapeBase">ShapeBase</a>
*
* @abstract
* @category Scene
* @order 2
* @class SceneChild
*/
class SceneChild {
/**
* Creates an instance of SceneChild.
* Base values will be assigned in case they are not passed
*
* @param {ISceneChildSettings} settings
*/
constructor(settings) {
var _a;
/**
* Shape generation id
* used for prevent buffer calculation
*
* @internal
* @ignore
*/
this.generateId = -1;
this.id = (_a = settings.id) !== null && _a !== void 0 ? _a : ++__id;
this.type = settings.type || 'SceneChild';
this.name = settings.name || this.type + '_' + this.id;
this.data = settings.data || {};
this.props = {};
}
/**
* Find this or form or children.
* Overridden by classes that extend it
*
* @param {string | number} idOrName
* @returns {(SceneChild | null)}
*/
find(idOrName) {
if (this.id === idOrName || this.name === idOrName)
return this;
return null;
}
/**
* Return the sceneChild properties
*
* @returns {Props}
*/
getProps() {
return this.props;
}
/**
* Return a sceneChild prop or default value
*
* @param {keyof Props} key
* @param {PropArguments} [propArguments]
* @param {*} [defaultValue]
* @returns {*}
*/
getProp(key, propArguments, defaultValue) {
var _a;
return ((_a = this.props[key]) !== null && _a !== void 0 ? _a : defaultValue);
}
/**
* Check SceneChild has prop
*
* @param {keyof Props} key
* @returns
*/
hasProp(key) {
return typeof this.props[key] !== 'undefined';
}
/**
* Set a single or multiple props
*
* @param {(keyof ISceneChildProps<PropArguments> | ISceneChildProps<PropArguments>)} key
* @param {*} [value]
*/
setPropUnsafe(key, value) {
if (typeof key == 'string')
this.props[key] = value;
else
Object.keys(key).forEach((k) => (this.props[k] = key[k]));
}
}
exports.SceneChild = SceneChild;
//# sourceMappingURL=SceneChild.js.map
/***/ }),
/* 6 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Group = void 0;
const Scene_1 = __webpack_require__(4);
const SceneChild_1 = __webpack_require__(5);
const ShapeBase_1 = __webpack_require__(7);
const Adapt_1 = __webpack_require__(31);
/**
* A SceneChild container, propagates properties to children
*
* @order 3
* @category Scene.Containers
* @extends {SceneChild}
* @example
* ```javascript
* // Group example
*
* const rect = new Urpflanze.Rect({
* distance: 100 // <- if a property is set the group will not overwrite it
* })
* const group = new Urpflanze.Group({
* repetitions: 3,
* distance: 200
* })
*
* group.add(rect)
* group.add(new Urpflanze.Triangle())
* ```
* @class Group
*/
class Group extends SceneChild_1.SceneChild {
/**
* Creates an instance of Group
*
* @param {ISceneChildSettings} [settings={}]
* @memberof Group
*/
constructor(settings = {}) {
settings.type = 'Group';
super(settings);
this.children = [];
['id', 'name', 'data', 'order', 'type'].forEach((prop) => {
if (prop in settings)
delete settings[prop];
});
this.props = settings;
}
/**
* Check group has static children
*
* @returns {boolean}
* @memberof Group
*/
isStatic() {
const children = this.children;
for (let i = 0, len = children.length; i < len; i++)
if (!children[i].isStatic())
return false;
return true;
}
/**
* Check group has static children indexed
*
* @returns {boolean}
* @memberof Group
*/
isStaticIndexed() {
const children = this.children;
for (let i = 0, len = children.length; i < len; i++)
if (!children[i].isStaticIndexed())
return false;
return true;
}
/**
* Add item to Group
*
* @param {Array<SceneChild>} items
* @memberof Group
*/
add(...items) {
for (let i = 0, len = items.length; i < len; i++) {
const item = items[i];
const rawItemProps = item.getProps();
Object.keys(this.props).forEach((propKey) => {
if (typeof rawItemProps[propKey] === 'undefined')
item.setProp(propKey, this.props[propKey]);
});
item.order =
typeof item.order !== 'undefined'
? item.order
: this.children.length > 0
? Math.max.apply(this, this.children.map(e => e.order || 0)) + 1
: 0;
this.scene && Scene_1.Scene.propagateToChilden(item, this.scene);
this.children.push(item);
}
this.sortChildren();
}
/**
* Sort children
*
* @memberof Group
*/
sortChildren() {
this.children.sort((a, b) => a.order - b.order);
this.children = this.children.map((child, index) => {
child.order = index;
return child;
});
this.clearBuffer(true);
}
/**
* Return shape children
*
* @returns {Array<SceneChild>}
* @memberof Group
*/
getChildren() {
return this.children;
}
/**
* Find scene child from id or name
*
* @param {number | string} idOrName
* @returns {(SceneChild | null)}
* @memberof Group
*/
find(idOrName) {
if (this.id === idOrName || this.name === idOrName)
return this;
const children = this.getChildren();
for (let i = 0, len = children.length; i < len; i++) {
const result = children[i].find(idOrName);
if (result !== null)
return result;
}
return null;
}
/**
* Get item from group
*
* @param {number} index
* @returns {(SceneChild | null)}
* @memberof Group
*/
get(index) {
return index >= 0 && index < this.children.length ? this.children[index] : null;
}
/**
* Remove item from group
*
* @param {number} index
* @returns {(false | Array<SceneChild>)}
* @memberof Group
*/
remove(index) {
if (index >= 0 && index < this.children.length) {
const removed = this.children.splice(index, 1);
this.clearBuffer(true);
return removed;
}
return false;
}
/**
* Remove from id
*
* @param {number} id
* @memberof Scene
*/
removeFromId(id) {
for (let i = 0, len = this.children.length; i < len; i++) {
if (this.children[i].id == id) {
this.children.splice(i, 1);
return this.clearBuffer(true);
}
}
}
/**
* Generate children buffers
*
* @param {number} generateId
* @param {boolean} [bDirectSceneChild=false]
* @param {IPropArguments} [parentPropArguments]
* @memberof Group
*/
generate(generateId, bDirectSceneChild = false, parentPropArguments) {
this.generateId = generateId;
this.children.forEach(item => item.generate(generateId, bDirectSceneChild, parentPropArguments));
}
/**
* Sum the children bounding
*
* @return {IShapeBounding}
*/
getBounding() {
const boundings = [];
const bounding = Adapt_1.Bounding.empty();
if (this.children.length > 0) {
this.children.forEach(item => boundings.push(item.getBounding()));
for (let i = 0, len = this.children.length; i < len; i++) {
bounding.x = bounding.x > boundings[i].x ? boundings[i].x : bounding.x;
bounding.y = bounding.y > boundings[i].y ? boundings[i].y : bounding.y;
bounding.width = bounding.width < boundings[i].width ? boundings[i].width : bounding.width;
bounding.height = bounding.height < boundings[i].height ? boundings[i].height : bounding.height;
}
bounding.cx = bounding.x + bounding.width / 2;
bounding.cy = bounding.y + bounding.height / 2;
}
return bounding;
}
/**
* Chear children buffer
*
* @param {boolean} [bClearIndexed=false]
* @param {boolean} [bPropagateToParents=false]
* @memberof Group
*/
clearBuffer(bClearIndexed = false, bPropagateToParents = true) {
this.children.forEach(item => item.clearBuffer(bClearIndexed, false));
if (this.scene && bPropagateToParents) {
const parents = this.scene.getParentsOfSceneChild(this);
parents.length > 0 && parents[parents.length - 1].clearBuffer(bClearIndexed, bPropagateToParents /* true */);
}
// if (bPropagateToParents && this.scene)
// {
// const parents = this.scene.getParentsOfSceneChild(this)
// parents.length > 0 && parents[parents.length - 1].clearBuffer(bClearIndexed, true, false)
// }
// if (bPropagateToChildren)
// {
// this.children.forEach(sceneChild => sceneChild.clearBuffer(bClearIndexed, false, true))
// }
}
/**
* Set a single or multiple props
*
* @abstract
* @param {(keyof ISceneChildProps | ISceneChildProps)} key
* @param {*} [value]
* @memberof SceneChild
*/
setProp(key, value) {
if (typeof key === 'object')
Object.keys(key).forEach((k) => (this.props[k] = key[k]));
else
this.props[key] = value;
this.children.forEach(item => item.setProp(key, value));
}
/**
* Set a single or multiple props
*
* @param {(keyof ISceneChildProps | ISceneChildProps)} key
* @param {*} [value]
* @memberof ShapeBase
*/
setPropUnsafe(key, value) {
super.setPropUnsafe(key, value);
this.children.forEach(item => item.setPropUnsafe(key, value));
}
/**
* Return length of buffer
*
* @param {IPropArguments} propArguments
* @returns {number}
* @memberof Group
*/
getBufferLength(propArguments) {
return this.children.map(sceneChild => sceneChild.getBufferLength(propArguments)).reduce((p, c) => p + c, 0);
}
/**
* return a single buffer binded from children
*
* @returns {Float32Array}
* @memberof Group
*/
getBuffer() {
const buffers = this.children
.map(item => item.getBuffer())
.filter(b => b !== undefined);
const size = buffers.reduce((currLength, buffer) => currLength + buffer.length, 0);
if (size > 0) {
const result = new Float32Array(size);
result.set(buffers[0], 0);
for (let i = 1, offset = 0, len = buffers.length; i < len; i++) {
offset += buffers[i - 1].length;
result.set(buffers[i], offset);
}
return result;
}
return ShapeBase_1.ShapeBase.EMPTY_BUFFER;
}
/**
* return a single buffer binded from children
*
* @returns {(Array<IBufferIndex> | undefined)}
* @memberof Group
*/
getIndexedBuffer() {
const indexed = this.children.map(item => item.getIndexedBuffer()).filter(b => b !== undefined);
return [].concat.apply([], indexed);
}
/**
* Call strem on children
*
* @param {(streamArguments: IStreamArguments) => void} callback
* @memberof Group
*/
stream(callback) {
this.children.forEach(item => item.stream(callback));
}
}
exports.Group = Group;
//# sourceMappingURL=Group.js.map
/***/ }),
/* 7 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ShapeBase = void 0;
const gl_matrix_1 = __webpack_require__(8);
const types_1 = __webpack_require__(19);
const glme = __webpack_require__(28);
const Vec2_1 = __webpack_require__(29);
const math_1 = __webpack_require__(30);
const Adapt_1 = __webpack_require__(31);
const Utilities_1 = __webpack_require__(33);
const SceneChild_1 = __webpack_require__(5);
const tmpMatrix = gl_matrix_1.mat4.create();
const transformMatrix = gl_matrix_1.mat4.create();
const perspectiveMatrix = gl_matrix_1.mat4.create();
const repetitionMatrix = gl_matrix_1.mat4.create();
/**
* Main class for shape generation
*
* @category Scene
* @abstract
* @class ShapeBase
* @order 4
* @extends {SceneChild}
*/
class ShapeBase extends SceneChild_1.SceneChild {
/**
* Creates an instance of ShapeBase
*
* @param {ISceneChildSettings} [settings={}]
*/
constructor(settings = {}) {
super(settings);
/**
* Flag used to determine if indexedBuffer has been generated
*
* @internal
* @ignore
*/
this.bIndexed = false;
/**
* Array used for index a vertex buffer
* only for first level scene children
*
* @internal
* @ignore
*/
this.indexedBuffer = [];
/**
* The bounding inside the scene
*
* @type {IShapeBounding}
*/
this.bounding = {
cx: 0,
cy: 0,
x: -1,
y: -1,
width: 2,
height: 2,
};
this.props = {
distance: settings.distance,
repetitions: settings.repetitions,
rotateX: settings.rotateX,
rotateY: settings.rotateY,
rotateZ: settings.rotateZ,
skewX: settings.skewX,
skewY: settings.skewY,
squeezeX: settings.squeezeX,
squeezeY: settings.squeezeY,
displace: settings.displace,
translate: settings.translate,
scale: settings.scale,
transformOrigin: settings.transformOrigin,
perspective: settings.perspective,
perspectiveOrigin: settings.perspectiveOrigin,
};
this.anchor =
settings.anchor && Array.isArray(settings.anchor)