mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
parent
4833c588e5
commit
d18fa8bb03
2 changed files with 7 additions and 4 deletions
|
@ -863,12 +863,14 @@ var Color = Base.extend(new function() {
|
||||||
destination.x, destination.y);
|
destination.x, destination.y);
|
||||||
}
|
}
|
||||||
for (var i = 0, l = stops.length; i < l; i++) {
|
for (var i = 0, l = stops.length; i < l; i++) {
|
||||||
var stop = stops[i];
|
var stop = stops[i],
|
||||||
|
offset = stop._offset;
|
||||||
// Use the defined offset, and fall back to automatic linear
|
// Use the defined offset, and fall back to automatic linear
|
||||||
// calculation.
|
// calculation.
|
||||||
// NOTE: that if _offset is 0 for the first entry, the fall-back
|
// NOTE: that if _offset is 0 for the first entry, the fall-back
|
||||||
// will be so too.
|
// will be so too.
|
||||||
canvasGradient.addColorStop(stop._offset || i / (l - 1),
|
canvasGradient.addColorStop(
|
||||||
|
offset == null ? i / (l - 1) : offset,
|
||||||
stop._color.toCanvasStyle());
|
stop._color.toCanvasStyle());
|
||||||
}
|
}
|
||||||
return this._canvasStyle = canvasGradient;
|
return this._canvasStyle = canvasGradient;
|
||||||
|
|
|
@ -232,9 +232,10 @@ new function() {
|
||||||
for (var i = 0, l = stops.length; i < l; i++) {
|
for (var i = 0, l = stops.length; i < l; i++) {
|
||||||
var stop = stops[i],
|
var stop = stops[i],
|
||||||
stopColor = stop._color,
|
stopColor = stop._color,
|
||||||
alpha = stopColor.getAlpha();
|
alpha = stopColor.getAlpha(),
|
||||||
|
offset = stop._offset;
|
||||||
attrs = {
|
attrs = {
|
||||||
offset: stop._offset || i / (l - 1)
|
offset: offset == null ? i / (l - 1) : offset
|
||||||
};
|
};
|
||||||
if (stopColor)
|
if (stopColor)
|
||||||
attrs['stop-color'] = stopColor.toCSS(true);
|
attrs['stop-color'] = stopColor.toCSS(true);
|
||||||
|
|
Loading…
Reference in a new issue