1
1
var gamejs = require ( '../gamejs'<
8000
/span>) ;
2
2
3
3
/**
4
- * @fileoverview ` Animations` on top of ` SpriteSheets` .
4
+ * @fileoverview Provides Animations and SpriteSheets.
5
5
*
6
6
* @example
7
7
* var spriteSheet = new SpriteSheet(sheetSurface, {width: 16, height: 16});
8
- * var animation = new Animation(spriteSheet, {walk: [0,1,2,3], loop: true});
9
- * animation.setState('walk');
8
+ * var animationSpec = {
9
+ * walk: {
10
+ * frames: [0,1,2,3],
11
+ * loop: true,
12
+ * rate: 20 // framerate per second
13
+ * }
14
+ * }
15
+ * var animation = new Animation(spriteSheet, 'walk', animationSpec);
10
16
* ....
11
17
* animation.update(msDuration)
12
18
* ....
13
- * display.blit(animation.currentFrame );
19
+ * display.blit(animation.image );
14
20
*
15
21
*/
16
22
@@ -103,7 +109,7 @@ var Animation = exports.Animation = function(spriteSheet, initial, spec) {
103
109
/** @ignore **/
104
110
this . spec = spec ;
105
111
106
- /** The current tile surface of the animation. Draw this to the screen. **/
112
+ /** @ignore **/
107
113
this . currentFrame = null ;
108
114
/** @ignore **/
109
115
this . currentFrameDuration = 0 ;
@@ -113,7 +119,7 @@ var Animation = exports.Animation = function(spriteSheet, initial, spec) {
113
119
this . _isFinished = false ;
114
120
/** @ignore **/
115
121
this . spriteSheet = spriteSheet ;
116
- /** @ignore **/
122
+ /** The current tile surface of the animation. Draw this to the screen. **/
117
123
this . image = spriteSheet . get ( 0 ) ;
118
124
this . start ( initial ) ;
119
125
0 commit comments