NodeFrame.js 610 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. function NodeFrame( time ) {
  5. this.time = time !== undefined ? time : 0;
  6. this.frameId = 0;
  7. };
  8. NodeFrame.prototype = {
  9. constructor: NodeFrame,
  10. update: function ( delta ) {
  11. ++this.frameId;
  12. this.time += delta;
  13. this.delta = delta;
  14. return this;
  15. },
  16. setRenderer: function( renderer ) {
  17. this.renderer = renderer;
  18. return this;
  19. },
  20. updateNode: function ( node ) {
  21. if ( node.frameId === this.frameId ) return this;
  22. node.updateFrame( this );
  23. node.frameId = this.frameId;
  24. return this;
  25. }
  26. };
  27. export { NodeFrame };