Tween
Events
- TweenEnd [property: String]
- when a tween finishes
Component to animate the change in 2D properties over time.
Back to top
.tween
public this .tween(Object properties, Number duration)
- properties
- Object of 2D properties and what they should animate to
- duration
- Duration to animate the properties over (in frames)
This method will animate a 2D entities properties over the specified duration.
These include x, y, w, h, alpha and rotation.
The object passed should have the properties as keys and the value should be the resulting values of the properties.
Example
Move an object to 100,100 and fade out in 200 frames.
Crafty.e("2D, Tween")
.attr({alpha: 1.0, x: 0, y: 0})
.tween({alpha: 0.0, x: 100, y: 100}, 200)

@craftyjs
#crafty@freenode.net
google groups
louis@craftyjs.com
github