UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

69 lines (65 loc) 2.86 kB
import { bF as BezierCurveEase, u as RegisterClass } from './index-MZPybX0H.esm.js'; import { F as FlowGraphBlock } from './KHR_interactivity-CEwUaqxQ.esm.js'; import { d as RichTypeNumber, q as RichTypeVector2, R as RichTypeAny } from './declarationMapper-CqO08-WM.esm.js'; import './objectModelMapping-De5EKNEZ.esm.js'; import './spotLight.pure-CRdZC6Ci.esm.js'; /** This file must only contain pure code and pure imports */ /** * An easing block that generates a BezierCurveEase easingFunction object based on the data provided. */ class FlowGraphBezierCurveEasingBlock extends FlowGraphBlock { constructor( /** * the configuration of the block */ config) { super(config); this.config = config; /** * Internal cache of reusable easing functions. * key is type-mode-properties */ this._easingFunctions = {}; this.mode = this.registerDataInput("mode", RichTypeNumber, 0); this.controlPoint1 = this.registerDataInput("controlPoint1", RichTypeVector2); this.controlPoint2 = this.registerDataInput("controlPoint2", RichTypeVector2); this.easingFunction = this.registerDataOutput("easingFunction", RichTypeAny); } _updateOutputs(context) { const mode = this.mode.getValue(context); const controlPoint1 = this.controlPoint1.getValue(context); const controlPoint2 = this.controlPoint2.getValue(context); if (mode === undefined) { return; } const key = `${mode}-${controlPoint1.x}-${controlPoint1.y}-${controlPoint2.x}-${controlPoint2.y}`; if (!this._easingFunctions[key]) { const easing = new BezierCurveEase(controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y); easing.setEasingMode(mode); this._easingFunctions[key] = easing; } this.easingFunction.setValue(this._easingFunctions[key], context); } getClassName() { return "FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */; } } let _Registered = false; /** * Register side effects for flowGraphBezierCurveEasingBlock. * Safe to call multiple times; only the first call has an effect. */ function RegisterFlowGraphBezierCurveEasingBlock() { if (_Registered) { return; } _Registered = true; RegisterClass("FlowGraphBezierCurveEasing" /* FlowGraphBlockNames.BezierCurveEasing */, FlowGraphBezierCurveEasingBlock); } /** * Re-exports pure implementation and applies runtime side effects. * Import flowGraphBezierCurveEasingBlock.pure for tree-shakeable, side-effect-free usage. */ RegisterFlowGraphBezierCurveEasingBlock(); export { FlowGraphBezierCurveEasingBlock, RegisterFlowGraphBezierCurveEasingBlock }; //# sourceMappingURL=flowGraphBezierCurveEasingBlock-BRJAHOuA.esm.js.map