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:
Eric Rowell
2014-01-07 00:43:31 -08:00
parent e594aa5656
commit 4d8ee45f71
9 changed files with 218 additions and 359 deletions

View File

@@ -798,88 +798,34 @@ suite('Node', 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,
index: 0,
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
});
@@ -958,39 +904,6 @@ suite('Node', function() {
showHit(layer);
});
// ======================================================
test('node caching width minimal configuration', function(done) {
var stage = addStage();
var layer = new Kinetic.Layer();
stage.add(layer);
var rect = new Kinetic.Rect({
width : 50,
height : 50,
fill: 'green',
stroke: 'blue',
strokeWidth: 5,
draggable: true
});
rect.toImage({
callback: function(imageObj) {
assert.equal(Kinetic.Util._isElement(imageObj), true);
var cachedShape = new Kinetic.Image({
image: imageObj,
draggable: true,
stroke: 'red',
strokeWidth: 5
});
layer.add(cachedShape);
layer.draw();
done();
}
});
showHit(layer);
});
// ======================================================
test('hide group', function() {
var stage = addStage();