mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
solve #1026
This commit is contained in:
parent
565adc2fb6
commit
362bcf9efc
11
kinetic.js
11
kinetic.js
@ -4,7 +4,7 @@
|
||||
* http://www.kineticjs.com/
|
||||
* Copyright 2013, Eric Rowell
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: 2014-09-24
|
||||
* Date: 2014-10-02
|
||||
*
|
||||
* Copyright (C) 2011 - 2013 by Eric Rowell
|
||||
*
|
||||
@ -6429,11 +6429,18 @@ var Kinetic = {};
|
||||
var that = this,
|
||||
node = config.node,
|
||||
nodeId = node._id,
|
||||
duration = config.duration || 1,
|
||||
duration,
|
||||
easing = config.easing || Kinetic.Easings.Linear,
|
||||
yoyo = !!config.yoyo,
|
||||
key;
|
||||
|
||||
if (typeof config.duration === 'undefined') {
|
||||
duration = 1;
|
||||
} else if (config.duration === 0) { // zero is bad value for duration
|
||||
duration = 0.001;
|
||||
} else {
|
||||
duration = config.duration;
|
||||
}
|
||||
this.node = node;
|
||||
this._id = idCounter++;
|
||||
|
||||
|
8
kinetic.min.js
vendored
8
kinetic.min.js
vendored
File diff suppressed because one or more lines are too long
@ -38,11 +38,18 @@
|
||||
var that = this,
|
||||
node = config.node,
|
||||
nodeId = node._id,
|
||||
duration = config.duration || 1,
|
||||
duration,
|
||||
easing = config.easing || Kinetic.Easings.Linear,
|
||||
yoyo = !!config.yoyo,
|
||||
key;
|
||||
|
||||
if (typeof config.duration === 'undefined') {
|
||||
duration = 1;
|
||||
} else if (config.duration === 0) { // zero is bad value for duration
|
||||
duration = 0.001;
|
||||
} else {
|
||||
duration = config.duration;
|
||||
}
|
||||
this.node = node;
|
||||
this._id = idCounter++;
|
||||
|
||||
|
@ -102,4 +102,42 @@ suite('Tween', function() {
|
||||
|
||||
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('zero duration', function(done) {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var circle = new Kinetic.Circle({
|
||||
x: 100,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'blue',
|
||||
strokeWidth: 4
|
||||
});
|
||||
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
|
||||
var tween = new Kinetic.Tween({
|
||||
node: circle,
|
||||
duration: 0,
|
||||
x: 200,
|
||||
y: 100
|
||||
});
|
||||
tween.play();
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
"use strict";
|
||||
assert.equal(circle.x(), 200);
|
||||
assert.equal(circle.y(), 100);
|
||||
done();
|
||||
}, 60);
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user