Vom Anderen PC aus hoch gespielt
This commit is contained in:
58
node_modules/three/examples/jsm/renderers/common/Animation.js
generated
vendored
Normal file
58
node_modules/three/examples/jsm/renderers/common/Animation.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
class Animation {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.nodes = null;
|
||||
|
||||
this.animationLoop = null;
|
||||
this.requestId = null;
|
||||
|
||||
this.isAnimating = false;
|
||||
|
||||
this.context = self;
|
||||
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
if ( this.isAnimating === true || this.animationLoop === null || this.nodes === null ) return;
|
||||
|
||||
this.isAnimating = true;
|
||||
|
||||
const update = ( time, frame ) => {
|
||||
|
||||
this.requestId = self.requestAnimationFrame( update );
|
||||
|
||||
this.nodes.nodeFrame.update();
|
||||
|
||||
this.animationLoop( time, frame );
|
||||
|
||||
};
|
||||
|
||||
this.requestId = self.requestAnimationFrame( update );
|
||||
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
self.cancelAnimationFrame( this.requestId );
|
||||
|
||||
this.isAnimating = false;
|
||||
|
||||
}
|
||||
|
||||
setAnimationLoop( callback ) {
|
||||
|
||||
this.animationLoop = callback;
|
||||
|
||||
}
|
||||
|
||||
setNodes( nodes ) {
|
||||
|
||||
this.nodes = nodes;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Animation;
|
||||
Reference in New Issue
Block a user