Switch from Gradient#type to separate LinearGradient / RadialGradient classes.

But remain backward compatible through direct calls to Gradient constructor.
This commit is contained in:
Jürg Lehni 2013-03-01 17:39:36 -08:00
parent 3f5d0a6925
commit 58fad6ed72
11 changed files with 58 additions and 42 deletions

View file

@ -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);
},

View file

@ -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);