mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
change method name
This commit is contained in:
parent
9acf26bfd5
commit
e6115ef643
@ -87,7 +87,7 @@
|
||||
index = this.frameIndex(),
|
||||
ix4 = index * 4,
|
||||
set = this.getAnimations()[anim],
|
||||
offsets = this.getOffsets(),
|
||||
offsets = this.frameOffsets(),
|
||||
x = set[ix4 + 0],
|
||||
y = set[ix4 + 1],
|
||||
width = set[ix4 + 2],
|
||||
@ -109,11 +109,18 @@
|
||||
index = this.frameIndex(),
|
||||
ix4 = index * 4,
|
||||
set = this.getAnimations()[anim],
|
||||
offsets = this.frameOffsets(),
|
||||
width = set[ix4 + 2],
|
||||
height = set[ix4 + 3];
|
||||
|
||||
context.beginPath();
|
||||
context.rect(0, 0, width, height);
|
||||
if (offsets) {
|
||||
var offset = offsets[anim];
|
||||
var ix2 = index * 2;
|
||||
context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height);
|
||||
} else {
|
||||
context.rect(0, 0, width, height);
|
||||
}
|
||||
context.closePath();
|
||||
context.fillShape(this);
|
||||
},
|
||||
@ -233,41 +240,41 @@
|
||||
* });
|
||||
*/
|
||||
|
||||
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'offsets');
|
||||
|
||||
/**
|
||||
* get/set offsets map
|
||||
* @name offsets
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Object} offsets
|
||||
* @returns {Object}
|
||||
* @example
|
||||
* // get offsets map
|
||||
* var offsets = sprite.offsets();
|
||||
*
|
||||
* // set offsets map
|
||||
* sprite.offsets({
|
||||
* standing: [
|
||||
* // x, y (6 frames)
|
||||
* 0, 0,
|
||||
* 0, 0,
|
||||
* 5, 0,
|
||||
* 0, 0,
|
||||
* 0, 3,
|
||||
* 2, 0
|
||||
* ],
|
||||
* kicking: [
|
||||
* // x, y (6 frames)
|
||||
* 0, 5,
|
||||
* 5, 0,
|
||||
* 10, 0,
|
||||
* 0, 0,
|
||||
* 2, 1,
|
||||
* 0, 0
|
||||
* ]
|
||||
* });
|
||||
*/
|
||||
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'frameOffsets');
|
||||
|
||||
/**
|
||||
* get/set offsets map
|
||||
* @name offsets
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Object} offsets
|
||||
* @returns {Object}
|
||||
* @example
|
||||
* // get offsets map
|
||||
* var offsets = sprite.offsets();
|
||||
*
|
||||
* // set offsets map
|
||||
* sprite.offsets({
|
||||
* standing: [
|
||||
* // x, y (6 frames)
|
||||
* 0, 0,
|
||||
* 0, 0,
|
||||
* 5, 0,
|
||||
* 0, 0,
|
||||
* 0, 3,
|
||||
* 2, 0
|
||||
* ],
|
||||
* kicking: [
|
||||
* // x, y (6 frames)
|
||||
* 0, 5,
|
||||
* 5, 0,
|
||||
* 10, 0,
|
||||
* 0, 0,
|
||||
* 2, 1,
|
||||
* 0, 0
|
||||
* ]
|
||||
* });
|
||||
*/
|
||||
|
||||
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'image');
|
||||
|
||||
|
BIN
test/assets/rabbit.png
Normal file
BIN
test/assets/rabbit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 KiB |
Loading…
Reference in New Issue
Block a user