Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 47ad835

Browse files
committed
bug fixes, some remain
1 parent dd723ef commit 47ad835

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
$.keyframe.define([ss]);
2323

24-
$('.spriteContainer').playSpriteSheet('gem', '10s');
24+
$('.spriteContainer').playSpriteSheet('gem', '8s');
2525
});
2626
</script>
2727
<style>
2828
.spriteContainer{
29-
width: 32px;
30-
height: 32px;
29+
width: 30px;
30+
height: 30px;
3131
background-image: url(emeraldspinning.png);
3232
}
3333
</style>

keyframes.spritesheet.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
width: 0,
1818
offsetX: 0,
1919
offsetY: 0,
20-
count: (opts.rows * opts.cols),
20+
count: (opts.rows-1 * opts.cols-1),
2121
spriteWidth: (opts.width / opts.cols),
2222
spriteHeight: (opts.height / opts.rows),
2323
loop: true
@@ -29,13 +29,13 @@
2929

3030
spriteStep = 100 / opts.count;
3131
spriteFrames = {};
32-
var x = opts.offsetX - opts.spriteWidth;
33-
var y = opts.offsetY - opts.spriteHeight;
32+
var x = opts.offsetX;
33+
var y = opts.offsetY;
3434
for(var i = 0; i < opts.count; i++){
3535
spriteFrames[Math.round(spriteStep * i) + '%'] = {
3636
'background-position': '-' + (opts.spriteWidth + x) + 'px -' + (opts.spriteHeight + y) + 'px'
3737
}
38-
if(x >= (opts.cols * opts.spriteWidth)){
38+
if(x >= opts.width - opts.spriteWidth){
3939
y += opts.spriteHeight;
4040
x = 0;
4141
}else{
@@ -65,7 +65,7 @@
6565
loops = 'infinite';
6666
}
6767

68-
var animate = name + ' ' + time + ' steps(' + opts.count + ') ' + loops;
68+
var animate = name + ' ' + time + ' steps(1) ' + loops;
6969
var existingAnimation = this.css('animation');
7070
if(existingAnimation.split(' ')[0] != "none"){
7171
animate = existingAnimation + ', ' + animate;

0 commit comments

Comments
 (0)