@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.
3 lines (2 loc) • 2.04 kB
JavaScript
import{R as t,f as i}from"./declarationMapper-13w1YGqM.esm.min.js";import{L as e,R as n}from"./index-Bw2N6w1y.esm.min.js";import{a as o}from"./KHR_interactivity-CKt1TdMW.esm.min.js";import"./objectModelMapping-DX92iJ8M.esm.min.js";class a extends o{constructor(e){super(e),this.animationGroup=this.registerDataInput("animationGroup",t),this.stopAtFrame=this.registerDataInput("stopAtFrame",i,-1)}_preparePendingTasks(t){const i=this.animationGroup.getValue(t),e=this.stopAtFrame.getValue(t)??-1,n=t._getGlobalContextVariable("pendingStopAnimations",[]);n.push({uniqueId:i.uniqueId,stopAtFrame:e}),t._setGlobalContextVariable("pendingStopAnimations",n)}_cancelPendingTasks(t){const i=this.animationGroup.getValue(t),e=t._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n<e.length;n++)if(e[n].uniqueId===i.uniqueId){e.splice(n,1),t._setGlobalContextVariable("pendingStopAnimations",e);break}}_execute(t){const i=this.animationGroup.getValue(t),n=this.stopAtFrame.getValue(t)??-1;return i?isNaN(n)?this._reportError(t,"Invalid stop time."):(n>0?this._startPendingTasks(t):this._stopAnimation(i,t),void this.out._activateSignal(t)):(e.Warn("No animation group provided to stop."),this._reportError(t,"No animation group provided to stop."))}_executeOnTick(t){const i=this.animationGroup.getValue(t),e=t._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n<e.length;n++)if(e[n].uniqueId===i.uniqueId&&i.getCurrentFrame()>=e[n].stopAtFrame){this._stopAnimation(i,t),e.splice(n,1),t._setGlobalContextVariable("pendingStopAnimations",e),this.done._activateSignal(t),t._removePendingBlock(this);break}}getClassName(){return"FlowGraphStopAnimationBlock"}_stopAnimation(t,i){const e=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),n=e.indexOf(t.uniqueId);-1!==n&&(t.stop(),e.splice(n,1),i._setGlobalContextVariable("currentlyRunningAnimationGroups",e))}}n("FlowGraphStopAnimationBlock",a);export{a as FlowGraphStopAnimationBlock};
//# sourceMappingURL=flowGraphStopAnimationBlock-CehHE0F4.esm.min.js.map