tween color properties

This commit is contained in:
lavrton
2015-02-16 06:31:28 +07:00
parent 7a7ea97c31
commit 36f4ab5346
6 changed files with 616 additions and 146 deletions

View File

@@ -139,4 +139,36 @@ suite('Tween', function() {
});
test('color tweening', function(done) {
var stage = addStage();
var layer = new Konva.Layer();
var circle = new Konva.Circle({
x: 100,
y: stage.getHeight() / 2,
radius: 70,
fill: 'red',
stroke: 'blue',
strokeWidth: 4
});
layer.add(circle);
stage.add(layer);
var c = Konva.Util.colorToRGBA('green');
var endFill = 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')';
var tween = new Konva.Tween({
node: circle,
duration: 0.1,
fill : endFill,
onFinish : function() {
assert.equal(endFill, circle.fill());
done();
}
});
tween.play();
});
});