gjs r142 - trunk/modules/tweener
- From: hp svn gnome org
- To: svn-commits-list gnome org
- Subject: gjs r142 - trunk/modules/tweener
- Date: Tue, 20 Jan 2009 18:11:38 +0000 (UTC)
Author: hp
Date: Tue Jan 20 18:11:38 2009
New Revision: 142
URL: http://svn.gnome.org/viewvc/gjs?rev=142&view=rev
Log:
change tweener _currentTime variable to a getTime() method on the ticker object
This virtualizes the time so a frame ticker can provide it.
This patch is not intended to change any behaviors, just move code
from hardcoded in tweener to virtualized in the default frame ticker
object.
Modified:
trunk/modules/tweener/tweener.js
Modified: trunk/modules/tweener/tweener.js
==============================================================================
--- trunk/modules/tweener/tweener.js (original)
+++ trunk/modules/tweener/tweener.js Tue Jan 20 18:11:38 2009
@@ -45,7 +45,6 @@
var _transitionList = null;
var _tweenList = null;
-var _currentTime = 0;
var _timeScale = 1;
/*
@@ -54,6 +53,7 @@
* property FRAME_RATE
* start()
* stop()
+ * getTime() gets time in milliseconds from start()
* signal prepare-frame
*
*/
@@ -73,10 +73,13 @@
},
start : function() {
+ this._currentTime = 0;
+
let me = this;
this._timeoutID =
Mainloop.timeout_add(Math.floor(1000 / 65),
function() {
+ me._currentTime += 1000 / me.FRAME_RATE;
me.emit('prepare-frame');
return true;
});
@@ -87,6 +90,12 @@
Mainloop.source_remove(this._timeoutID);
delete this._timeoutID;
}
+
+ this._currentTime = 0;
+ },
+
+ getTime : function() {
+ return this._currentTime;
}
};
Signals.addSignalMethods(FrameTicker.prototype);
@@ -137,8 +146,6 @@
_prepareFrameId = _ticker.connect('prepare-frame',
_onEnterFrame);
_ticker.start();
-
- _currentTime = 0;
}
function _stopEngine() {
@@ -147,7 +154,6 @@
_engineExists = false;
_tweenList = false;
- _currentTime = 0;
_ticker.disconnect(_prepareFrameId);
_prepareFrameId = 0;
@@ -155,7 +161,7 @@
}
function _getCurrentTweeningTime(tweening) {
- return _currentTime;
+ return _ticker.getTime();
}
function _removeTweenByIndex(i) {
@@ -325,8 +331,6 @@
/* Ran once every 'frame'. It's the main engine, updates all existing tweenings */
function _onEnterFrame() {
- _currentTime += 1000/_ticker.FRAME_RATE;
-
if (!_updateTweens())
_stopEngine();
@@ -469,8 +473,8 @@
}
tween = new TweenList.TweenList(scopes[i],
- _currentTime + ((delay * 1000) / _timeScale),
- _currentTime + (((delay * 1000) + (time * 1000)) / _timeScale),
+ _ticker.getTime() + ((delay * 1000) / _timeScale),
+ _ticker.getTime() + (((delay * 1000) + (time * 1000)) / _timeScale),
false,
transition,
obj.transitionParams);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]