mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Merge pull request #68 from pronebird/fix-tween-color-alpha
Fix color alpha rounding bug. (Fixes #67)
This commit is contained in:
commit
aac7fe3e8c
@ -156,7 +156,7 @@
|
||||
Math.round(start.r + diff.r * i) + ',' +
|
||||
Math.round(start.g + diff.g * i) + ',' +
|
||||
Math.round(start.b + diff.b * i) + ',' +
|
||||
Math.round(start.a + diff.a * i) + ')';
|
||||
(start.a + diff.a * i) + ')';
|
||||
} else {
|
||||
newVal = start + (diff * i);
|
||||
}
|
||||
|
@ -156,17 +156,25 @@ suite('Tween', function() {
|
||||
layer.add(circle);
|
||||
stage.add(layer);
|
||||
|
||||
var c = Konva.Util.colorToRGBA('green');
|
||||
var duration = 0.1;
|
||||
var c = Konva.Util.colorToRGBA('rgba(0,255,0,0.5)');
|
||||
var endFill = 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')';
|
||||
var midFill = 'rgba(128,128,0,0.75)';
|
||||
|
||||
var tween = new Konva.Tween({
|
||||
node: circle,
|
||||
duration: 0.1,
|
||||
duration: duration,
|
||||
fill : endFill,
|
||||
onFinish : function() {
|
||||
assert.equal(endFill, circle.fill());
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
tween.seek(duration * 0.5);
|
||||
assert.equal(midFill, circle.fill());
|
||||
|
||||
tween.seek(0);
|
||||
tween.play();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user