diff --git a/src/Three.js b/src/Three.js index c67274d6eb1df7a59e2c8b25fc0497fcf478c37d..1568793c4b68614ee0089dd4290e703f973383a4 100644 --- a/src/Three.js +++ b/src/Three.js @@ -16,80 +16,6 @@ if ( typeof define === 'function' && define.amd ) { } - -// polyfills - -if ( self.requestAnimationFrame === undefined || self.cancelAnimationFrame === undefined ) { - - // Missing in Android stock browser. - - ( function () { - - var lastTime = 0; - var vendors = [ 'ms', 'moz', 'webkit', 'o' ]; - - for ( var x = 0; x < vendors.length && ! self.requestAnimationFrame; ++ x ) { - - self.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ]; - self.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] || self[ vendors[ x ] + 'CancelRequestAnimationFrame' ]; - - } - - if ( self.requestAnimationFrame === undefined && self.setTimeout !== undefined ) { - - self.requestAnimationFrame = function ( callback ) { - - var currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); - var id = self.setTimeout( function () { - - callback( currTime + timeToCall ); - - }, timeToCall ); - lastTime = currTime + timeToCall; - return id; - - }; - - } - - if ( self.cancelAnimationFrame === undefined && self.clearTimeout !== undefined ) { - - self.cancelAnimationFrame = function ( id ) { - - self.clearTimeout( id ); - - }; - - } - - } )(); - -} - -// - -if ( self.performance === undefined ) { - - self.performance = {}; - -} - -if ( self.performance.now === undefined ) { - - ( function () { - - var start = Date.now(); - - self.performance.now = function () { - - return Date.now() - start; - - } - - } )(); - -} - // if ( Number.EPSILON === undefined ) { diff --git a/src/core/Clock.js b/src/core/Clock.js index 21d664cf73e2f37965f1343344c078496216aff8..635fc57cbd0906adedce0253813806676d29a51c 100644 --- a/src/core/Clock.js +++ b/src/core/Clock.js @@ -20,7 +20,7 @@ THREE.Clock.prototype = { start: function () { - this.startTime = self.performance.now(); + this.startTime = performance.now(); this.oldTime = this.startTime; this.running = true; @@ -53,7 +53,7 @@ THREE.Clock.prototype = { if ( this.running ) { - var newTime = self.performance.now(); + var newTime = performance.now(); diff = 0.001 * ( newTime - this.oldTime ); this.oldTime = newTime;