mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 08:46:44 +08:00
change method name
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
index = this.frameIndex(),
|
index = this.frameIndex(),
|
||||||
ix4 = index * 4,
|
ix4 = index * 4,
|
||||||
set = this.getAnimations()[anim],
|
set = this.getAnimations()[anim],
|
||||||
offsets = this.getOffsets(),
|
offsets = this.frameOffsets(),
|
||||||
x = set[ix4 + 0],
|
x = set[ix4 + 0],
|
||||||
y = set[ix4 + 1],
|
y = set[ix4 + 1],
|
||||||
width = set[ix4 + 2],
|
width = set[ix4 + 2],
|
||||||
@@ -109,11 +109,18 @@
|
|||||||
index = this.frameIndex(),
|
index = this.frameIndex(),
|
||||||
ix4 = index * 4,
|
ix4 = index * 4,
|
||||||
set = this.getAnimations()[anim],
|
set = this.getAnimations()[anim],
|
||||||
|
offsets = this.frameOffsets(),
|
||||||
width = set[ix4 + 2],
|
width = set[ix4 + 2],
|
||||||
height = set[ix4 + 3];
|
height = set[ix4 + 3];
|
||||||
|
|
||||||
context.beginPath();
|
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.closePath();
|
||||||
context.fillShape(this);
|
context.fillShape(this);
|
||||||
},
|
},
|
||||||
@@ -233,41 +240,41 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'offsets');
|
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'frameOffsets');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set offsets map
|
* get/set offsets map
|
||||||
* @name offsets
|
* @name offsets
|
||||||
* @method
|
* @method
|
||||||
* @memberof Kinetic.Sprite.prototype
|
* @memberof Kinetic.Sprite.prototype
|
||||||
* @param {Object} offsets
|
* @param {Object} offsets
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
* @example
|
* @example
|
||||||
* // get offsets map
|
* // get offsets map
|
||||||
* var offsets = sprite.offsets();
|
* var offsets = sprite.offsets();
|
||||||
*
|
*
|
||||||
* // set offsets map
|
* // set offsets map
|
||||||
* sprite.offsets({
|
* sprite.offsets({
|
||||||
* standing: [
|
* standing: [
|
||||||
* // x, y (6 frames)
|
* // x, y (6 frames)
|
||||||
* 0, 0,
|
* 0, 0,
|
||||||
* 0, 0,
|
* 0, 0,
|
||||||
* 5, 0,
|
* 5, 0,
|
||||||
* 0, 0,
|
* 0, 0,
|
||||||
* 0, 3,
|
* 0, 3,
|
||||||
* 2, 0
|
* 2, 0
|
||||||
* ],
|
* ],
|
||||||
* kicking: [
|
* kicking: [
|
||||||
* // x, y (6 frames)
|
* // x, y (6 frames)
|
||||||
* 0, 5,
|
* 0, 5,
|
||||||
* 5, 0,
|
* 5, 0,
|
||||||
* 10, 0,
|
* 10, 0,
|
||||||
* 0, 0,
|
* 0, 0,
|
||||||
* 2, 1,
|
* 2, 1,
|
||||||
* 0, 0
|
* 0, 0
|
||||||
* ]
|
* ]
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'image');
|
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 |
Reference in New Issue
Block a user