|
@@ -2,21 +2,37 @@
|
|
|
* @author sunag / http://www.sunag.com.br/
|
|
|
*/
|
|
|
|
|
|
-THREE.TimerNode = function ( value, scale ) {
|
|
|
+THREE.TimerNode = function ( scope, scale ) {
|
|
|
|
|
|
- THREE.FloatNode.call( this, value );
|
|
|
+ THREE.FloatNode.call( this );
|
|
|
|
|
|
+ this.scope = scope || THREE.TimerNode.GLOBAL;
|
|
|
this.scale = scale !== undefined ? scale : 1;
|
|
|
|
|
|
};
|
|
|
|
|
|
+THREE.TimerNode.GLOBAL = 'global';
|
|
|
+THREE.TimerNode.LOCAL = 'local';
|
|
|
+
|
|
|
THREE.TimerNode.prototype = Object.create( THREE.FloatNode.prototype );
|
|
|
THREE.TimerNode.prototype.constructor = THREE.TimerNode;
|
|
|
THREE.TimerNode.prototype.nodeType = "Timer";
|
|
|
|
|
|
-THREE.TimerNode.prototype.updateFrame = function ( delta ) {
|
|
|
+THREE.TimerNode.prototype.updateFrame = function ( frame ) {
|
|
|
+
|
|
|
+ switch( this.scope ) {
|
|
|
+
|
|
|
+ case THREE.TimerNode.LOCAL:
|
|
|
+
|
|
|
+ this.number += frame.delta * this.scale;
|
|
|
|
|
|
- this.number += delta * this.scale;
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+
|
|
|
+ this.number = frame.time * this.scale;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
};
|
|
|
|
|
@@ -28,6 +44,7 @@ THREE.TimerNode.prototype.toJSON = function ( meta ) {
|
|
|
|
|
|
data = this.createJSONNode( meta );
|
|
|
|
|
|
+ data.scope = this.scope;
|
|
|
data.scale = this.scale;
|
|
|
|
|
|
}
|