mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -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);
|
||||
}
|
||||
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
|
||||
// calculation.
|
||||
// NOTE: that if _offset is 0 for the first entry, the fall-back
|
||||
// will be so too.
|
||||
canvasGradient.addColorStop(stop._offset || i / (l - 1),
|
||||
canvasGradient.addColorStop(
|
||||
offset == null ? i / (l - 1) : offset,
|
||||
stop._color.toCanvasStyle());
|
||||
}
|
||||
return this._canvasStyle = canvasGradient;
|
||||
|
|
|
@ -232,9 +232,10 @@ new function() {
|
|||
for (var i = 0, l = stops.length; i < l; i++) {
|
||||
var stop = stops[i],
|
||||
stopColor = stop._color,
|
||||
alpha = stopColor.getAlpha();
|
||||
alpha = stopColor.getAlpha(),
|
||||
offset = stop._offset;
|
||||
attrs = {
|
||||
offset: stop._offset || i / (l - 1)
|
||||
offset: offset == null ? i / (l - 1) : offset
|
||||
};
|
||||
if (stopColor)
|
||||
attrs['stop-color'] = stopColor.toCSS(true);
|
||||
|
|
Loading…
Reference in a new issue