mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Sprite animations keys are now set to arrays of integers, not array of object literals containing x y width and height. changed index attr to frameIndex
This commit is contained in:
@@ -6,87 +6,35 @@ suite('Sprite', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var anims = {
|
||||
standing: [{
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}, {
|
||||
x: 52,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}, {
|
||||
x: 105,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}, {
|
||||
x: 158,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}, {
|
||||
x: 210,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}, {
|
||||
x: 262,
|
||||
y: 0,
|
||||
width: 49,
|
||||
height: 109
|
||||
}],
|
||||
|
||||
kicking: [{
|
||||
x: 0,
|
||||
y: 109,
|
||||
width: 45,
|
||||
height: 98
|
||||
}, {
|
||||
x: 45,
|
||||
y: 109,
|
||||
width: 45,
|
||||
height: 98
|
||||
}, {
|
||||
x: 95,
|
||||
y: 109,
|
||||
width: 63,
|
||||
height: 98
|
||||
}, {
|
||||
x: 156,
|
||||
y: 109,
|
||||
width: 70,
|
||||
height: 98
|
||||
}, {
|
||||
x: 229,
|
||||
y: 109,
|
||||
width: 60,
|
||||
height: 98
|
||||
}, {
|
||||
x: 287,
|
||||
y: 109,
|
||||
width: 41,
|
||||
height: 98
|
||||
}]
|
||||
};
|
||||
|
||||
//for(var n = 0; n < 50; n++) {
|
||||
sprite = new Kinetic.Sprite({
|
||||
//x: Math.random() * stage.getWidth() - 30,
|
||||
var sprite = new Kinetic.Sprite({
|
||||
x: 200,
|
||||
//y: Math.random() * stage.getHeight() - 50,
|
||||
y: 50,
|
||||
image: imageObj,
|
||||
animation: 'standing',
|
||||
animations: anims,
|
||||
frameRate: Math.random() * 6 + 6,
|
||||
animations: {
|
||||
standing: [
|
||||
0, 0, 49, 109,
|
||||
52, 0, 49, 109,
|
||||
105, 0, 49, 109,
|
||||
158, 0, 49, 109,
|
||||
210, 0, 49, 109,
|
||||
262, 0, 49, 109
|
||||
],
|
||||
kicking: [
|
||||
0, 109, 45, 98,
|
||||
45, 109, 45, 98,
|
||||
95, 109, 63, 98,
|
||||
156, 109, 70, 98,
|
||||
229, 109, 60, 98,
|
||||
287, 109, 41, 98
|
||||
]
|
||||
},
|
||||
frameRate: 10,
|
||||
draggable: true,
|
||||
shadowColor: 'black',
|
||||
shadowBlur: 3,
|
||||
shadowOffset: [3, 1],
|
||||
shadowOffset: {x: 3, y:1},
|
||||
shadowOpacity: 0.3
|
||||
});
|
||||
|
||||
@@ -94,7 +42,7 @@ suite('Sprite', function() {
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(sprite.getClassName(), 'Sprite');
|
||||
assert.equal(sprite.getIndex(), 0);
|
||||
assert.equal(sprite.frameIndex(), 0);
|
||||
|
||||
showHit(layer);
|
||||
|
||||
|
Reference in New Issue
Block a user