mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
build
This commit is contained in:
parent
214da03a7d
commit
abde07dd87
54
kinetic.js
54
kinetic.js
@ -12798,6 +12798,7 @@ var Kinetic = {};
|
||||
index = this.frameIndex(),
|
||||
ix4 = index * 4,
|
||||
set = this.getAnimations()[anim],
|
||||
offsets = this.frameOffsets(),
|
||||
x = set[ix4 + 0],
|
||||
y = set[ix4 + 1],
|
||||
width = set[ix4 + 2],
|
||||
@ -12805,7 +12806,13 @@ var Kinetic = {};
|
||||
image = this.getImage();
|
||||
|
||||
if(image) {
|
||||
context.drawImage(image, x, y, width, height, 0, 0, width, height);
|
||||
if (offsets) {
|
||||
var offset = offsets[anim],
|
||||
ix2 = index * 2;
|
||||
context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height);
|
||||
} else {
|
||||
context.drawImage(image, x, y, width, height, 0, 0, width, height);
|
||||
}
|
||||
}
|
||||
},
|
||||
_hitFunc: function(context) {
|
||||
@ -12813,11 +12820,18 @@ var Kinetic = {};
|
||||
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);
|
||||
},
|
||||
@ -12937,6 +12951,42 @@ var Kinetic = {};
|
||||
* });
|
||||
*/
|
||||
|
||||
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');
|
||||
|
||||
/**
|
||||
|
2
kinetic.min.js
vendored
2
kinetic.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user