NodeFrame.js 638 B

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