now using setAttrs for all Shape and shapes setters

This commit is contained in:
Eric Rowell
2012-06-10 00:02:16 -07:00
parent 13105969b1
commit 6b70e1b18f
12 changed files with 298 additions and 152 deletions

View File

@@ -23,7 +23,7 @@ Kinetic.Sprite = function(config) {
context.beginPath();
context.rect(0, 0, f.width, f.height);
context.closePath();
this.drawImage(this.attrs.image, f.x, f.y, f.width, f.height, 0, 0, f.width, f.height);
}
};
@@ -68,14 +68,18 @@ Kinetic.Sprite.prototype = {
* @param {String} anim animation key
*/
setAnimation: function(anim) {
this.attrs.animation = anim;
this.setAttrs({
animation: anim
});
},
/**
* set animations obect
* @param {Object} animations
*/
setAnimations: function(animations) {
this.attrs.animations = animations;
this.setAttrs({
animations: animations
});
},
/**
* get animations object
@@ -94,7 +98,9 @@ Kinetic.Sprite.prototype = {
* @param {Integer} index frame index
*/
setIndex: function(index) {
this.attrs.index = index;
this.setAttrs({
index: index
});
},
_updateIndex: function() {
var i = this.attrs.index;