preact
This commit is contained in:
parent
6acf267d48
commit
b7614eb3f8
4794 changed files with 1280808 additions and 1546 deletions
50
frontend/node_modules/three/examples/jsm/renderers/common/Animation.js
generated
vendored
Normal file
50
frontend/node_modules/three/examples/jsm/renderers/common/Animation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
class Animation {
|
||||
|
||||
constructor( nodes, info ) {
|
||||
|
||||
this.nodes = nodes;
|
||||
this.info = info;
|
||||
|
||||
this.animationLoop = null;
|
||||
this.requestId = null;
|
||||
|
||||
this._init();
|
||||
|
||||
}
|
||||
|
||||
_init() {
|
||||
|
||||
const update = ( time, frame ) => {
|
||||
|
||||
this.requestId = self.requestAnimationFrame( update );
|
||||
|
||||
if ( this.info.autoReset === true ) this.info.reset();
|
||||
|
||||
this.nodes.nodeFrame.update();
|
||||
|
||||
this.info.frame = this.nodes.nodeFrame.frameId;
|
||||
|
||||
if ( this.animationLoop !== null ) this.animationLoop( time, frame );
|
||||
|
||||
};
|
||||
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
||||
self.cancelAnimationFrame( this.requestId );
|
||||
this.requestId = null;
|
||||
|
||||
}
|
||||
|
||||
setAnimationLoop( callback ) {
|
||||
|
||||
this.animationLoop = callback;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Animation;
|
||||
Loading…
Add table
Add a link
Reference in a new issue