Skip to content

Commit

Permalink
Made documentation JSDuck-compatible; fixed default value of the flip…
Browse files Browse the repository at this point in the history
…ped option; made a few more methods chainable; removed trailing commas
  • Loading branch information
IceCreamYou committed Jan 3, 2013
1 parent 99ba220 commit fba0ea7
Show file tree
Hide file tree
Showing 3 changed files with 362 additions and 201 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ of available functionality.
- reset(): Reset the animation sequence to the first frame.
- changeFrame(delta): Move the animation sequence forward or backward.
- setFrame(row, col) or setFrame(frame): Move to a specific frame.
- setLoop(startRow, startCol, endRow, endCol, squeeze): Change the
- setLoop(startRow, startCol, endRow, endCol, squeeze, flipped): Change the
animation sequence.
- startLoop(startRow, startCol, endRow, endCol, squeeze): Start animating
the animation sequence in a loop.
- startLoop(startRow, startCol, endRow, endCol, squeeze, flipped): Start
animating the animation sequence in a loop.
- stopLoop(): Stop animating.
- runLoop(startRow, startCol, endRow, endCol, squeeze): Run the animation
sequence once.
- runLoop(startRow, startCol, endRow, endCol, squeeze, flipped): Run the
animation sequence once.
- prevFrame(): Go to the previous animation frame.
- nextFrame(): Go to the next animation frame.
- getFrame(): Get the current animation frame (row, column, frame number).
Expand Down
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
window.setTimeout(callback, 1000 / 60);
};
})();

function animate() { // Animation loop that draws the canvas
context.clearRect(0, 0, context.canvas.width, context.canvas.height); // Clear the canvas
spriteMap.draw(context, 100, 100); // Draw the sprite
requestAnimFrame(animate); // Run the animation loop
}

window.onload = function() {
// Get the canvas graphics context
context = document.getElementById('canvas').getContext('2d');
Expand All @@ -47,7 +49,7 @@
BodyAltWalk: {startRow: 3, startCol: 1, endRow: 4, endCol: 4},
BodyDown: {startRow: 4, startCol: 5, endRow: 4, endCol: 5},
Walk: {startRow: 4, startCol: 6, endRow: 6, endCol: 0},
Face: {startRow: 6, startCol: 1, endRow: 6, endCol: 1},
Face: {startRow: 6, startCol: 1, endRow: 6, endCol: 1}
},
{ // options
frameW: 52, // Width of each frame of the animation in pixels
Expand All @@ -63,7 +65,7 @@
animNo = (animNo + 1) % animNames.length;
spriteMap.use(animNames[animNo]); // Switch animation sequences
}, 2500);
}, // Do something when the sprite finishes loading
} // Do something when the sprite finishes loading
}
);
}
Expand Down
Loading

0 comments on commit fba0ea7

Please sign in to comment.