Sha256: 7beb441fddef0b735ecb85b0af0b3f933993d2c2b30f2621ef254fdc1f3f1e52

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

/*
The tween component tweens properties of entities to the given value over a period of time.

This is useful for animations.

re.e('tween')
.tween(0.8, {x:10});

*/
re.c('tween')
.requires('update')
.statics({
	
	tween:function(obj, time, props){
		return obj.comp('tween')
		.tween(time, props);
	}
	
})
.namespaces({

	update:function(t){
		
		
		
	}

})
.defaults({
	
	tweening:false
	
})
.defines({
	
	tween:function(time, props){
		this.time = time || 5;
		
		if(this.tweening){
			this.unbind('update', this.tween_update);
		}
		
		//collect properties
		for(var i in props){
			
			if(!props.hasOwnProperty(i)) continue;
			
			this.tween_props[i] = {s:re.sys.stepSize, i:props[i]};
			
		}
		
		return this;
	}
	
})
.init(function(){
	
	this.tween_props = {};
	
});
re.tween = re.c('tween').tween;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
entityjs-0.3.1 src/cycle/tween.js
entityjs-0.3.0 src/cycle/tween.js