NodeFrame.js 555 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. class NodeFrame {
  2. constructor( time ) {
  3. this.time = time !== undefined ? time : 0;
  4. this.id = 0;
  5. }
  6. update( delta ) {
  7. ++ this.id;
  8. this.time += delta;
  9. this.delta = delta;
  10. return this;
  11. }
  12. setRenderer( renderer ) {
  13. this.renderer = renderer;
  14. return this;
  15. }
  16. setRenderTexture( renderTexture ) {
  17. this.renderTexture = renderTexture;
  18. return this;
  19. }
  20. updateNode( node ) {
  21. if ( node.frameId === this.id ) return this;
  22. node.updateFrame( this );
  23. node.frameId = this.id;
  24. return this;
  25. }
  26. }
  27. export { NodeFrame };