mirror of
https://github.com/konvajs/konva.git
synced 2025-09-20 20:08:00 +08:00
removed point specific logic from the Transition class. To run transitions, you can now only transition properties which are numbers only. This means that if you want to transition a point, such as offset, you can transition the offset property with a number which will transition both x and y, or you can transition offsetX or offsetY individually
This commit is contained in:
@@ -17,10 +17,7 @@
|
|||||||
easingFunc = Kinetic.Tweens[easing],
|
easingFunc = Kinetic.Tweens[easing],
|
||||||
duration = config.duration || 0,
|
duration = config.duration || 0,
|
||||||
configVal = null,
|
configVal = null,
|
||||||
lastTweenIndex = 0,
|
lastTweenIndex = 0;
|
||||||
obj = {},
|
|
||||||
x = 0,
|
|
||||||
y = 0;
|
|
||||||
|
|
||||||
this.tweens = [];
|
this.tweens = [];
|
||||||
this.attrs = {};
|
this.attrs = {};
|
||||||
@@ -29,24 +26,9 @@
|
|||||||
for (var key in config) {
|
for (var key in config) {
|
||||||
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
||||||
configVal = config[key];
|
configVal = config[key];
|
||||||
obj = node.getAttr(key);
|
|
||||||
if(Kinetic.Type._isObject(obj)) {
|
|
||||||
configValX = configVal.x;
|
|
||||||
configValY = configVal.y;
|
|
||||||
|
|
||||||
this.attrs[key] = {};
|
|
||||||
if (configValX !== undefined) {
|
|
||||||
that.tweens.push(createTween(this.attrs[key], 'x', easingFunc, obj.x, configValX, duration));
|
|
||||||
}
|
|
||||||
if (configValY !== undefined) {
|
|
||||||
that.tweens.push(createTween(this.attrs[key], 'y', easingFunc, obj.y, configValY, duration));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
that.tweens.push(createTween(this.attrs, key, easingFunc, node.getAttr(key), configVal, duration));
|
that.tweens.push(createTween(this.attrs, key, easingFunc, node.getAttr(key), configVal, duration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
lastTweenIndex = this.tweens.length - 1;
|
lastTweenIndex = this.tweens.length - 1;
|
||||||
|
|
||||||
|
@@ -79,10 +79,8 @@ Test.Modules.TRANSITION = {
|
|||||||
this.trans.stop();
|
this.trans.stop();
|
||||||
}
|
}
|
||||||
this.trans = this.transitionTo({
|
this.trans = this.transitionTo({
|
||||||
scale: {
|
scaleX: 1.5,
|
||||||
x: 1.5,
|
scaleY: 1.5,
|
||||||
y: 1.5
|
|
||||||
},
|
|
||||||
duration: 1,
|
duration: 1,
|
||||||
easing: easing,
|
easing: easing,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
@@ -95,10 +93,8 @@ Test.Modules.TRANSITION = {
|
|||||||
this.trans.stop();
|
this.trans.stop();
|
||||||
}
|
}
|
||||||
this.trans = this.transitionTo({
|
this.trans = this.transitionTo({
|
||||||
scale: {
|
scaleX: 1,
|
||||||
x: 1,
|
scaleY: 1,
|
||||||
y: 1
|
|
||||||
},
|
|
||||||
duration: 1,
|
duration: 1,
|
||||||
easing: easing
|
easing: easing
|
||||||
});
|
});
|
||||||
|
@@ -184,9 +184,7 @@ Test.Modules.TRANSITION = {
|
|||||||
|
|
||||||
var trans = rect.transitionTo({
|
var trans = rect.transitionTo({
|
||||||
duration: 2,
|
duration: 2,
|
||||||
shadowOffset: {
|
shadowOffsetX: 80,
|
||||||
x: 80
|
|
||||||
},
|
|
||||||
x: 400,
|
x: 400,
|
||||||
y: 30,
|
y: 30,
|
||||||
rotation: Math.PI * 2,
|
rotation: Math.PI * 2,
|
||||||
|
Reference in New Issue
Block a user