mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-10 21:19:10 -04:00
Switch from Gradient#type to separate LinearGradient / RadialGradient classes.
But remain backward compatible through direct calls to Gradient constructor.
This commit is contained in:
parent
3f5d0a6925
commit
58fad6ed72
11 changed files with 58 additions and 42 deletions
examples/Scripts
|
@ -32,14 +32,14 @@
|
|||
new Path.Circle(overlayPos, this.radius / 2)
|
||||
]);
|
||||
var color = new HsbColor(Math.random() * 360, 1, 1);
|
||||
var gradient = new Gradient([color, 'black'], 'radial');
|
||||
var gradient = new RadialGradient([color, 'black']);
|
||||
compound.fillColor = new GradientColor(gradient, this.point,
|
||||
this.point + this.radius, overlayPos);
|
||||
var overlay = new Path.Circle(overlayPos, this.radius / 2);
|
||||
var overlayColor = color.clone();
|
||||
var fullOverlay = color.clone();
|
||||
overlayColor.alpha = 0.5;
|
||||
var overlayGradient = new Gradient([new RgbColor(1, 1, 1, 0.5), new RgbColor(1, 1, 1, 1)]);
|
||||
var overlayGradient = new LinearGradient([new RgbColor(1, 1, 1, 0.5), new RgbColor(1, 1, 1, 1)]);
|
||||
overlay.fillColor = new GradientColor(overlayGradient, overlayPos, overlayPos + this.radius / 2);
|
||||
this.item = new Group(compound, overlay);
|
||||
},
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
var color = new HslColor(hue, saturation, lightness);
|
||||
colors.push(color);
|
||||
}
|
||||
var gradient = new Gradient(colors, 'radial');
|
||||
var gradient = new RadialGradient(colors);
|
||||
var from = center;
|
||||
var to = center + vector;
|
||||
var gradientColor = new GradientColor(gradient, from, to);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue