NodeFrame.js 515 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. updateNode: function ( node ) {
  17. if ( node.frameId === this.frameId ) return this;
  18. node.updateFrame( this );
  19. node.frameId = this.frameId;
  20. return this;
  21. }
  22. };
  23. export { NodeFrame };