2011-03-06 19:50:44 -05:00
|
|
|
/*
|
|
|
|
* Paper.js
|
|
|
|
*
|
|
|
|
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
|
|
|
|
* based on Scriptographer.org and designed to be largely API compatible.
|
|
|
|
* http://scriptographer.org/
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
|
|
|
|
* http://lehni.org/ & http://jonathanpuckey.com/
|
|
|
|
*
|
|
|
|
* All rights reserved. See LICENSE file for details.
|
|
|
|
*/
|
|
|
|
|
2011-03-04 08:34:31 -05:00
|
|
|
var Gradient = this.Gradient = Base.extend({
|
2011-03-04 20:26:12 -05:00
|
|
|
beans: true,
|
|
|
|
|
2011-02-19 16:50:37 -05:00
|
|
|
initialize: function() {
|
2011-03-04 20:26:12 -05:00
|
|
|
this.setStops([
|
2011-03-03 17:45:17 -05:00
|
|
|
new GradientStop('white', 0),
|
2011-03-04 20:26:12 -05:00
|
|
|
new GradientStop('black', 1)]);
|
2011-02-19 16:50:37 -05:00
|
|
|
this.type = 'linear';
|
|
|
|
},
|
2011-03-03 17:45:17 -05:00
|
|
|
|
2011-02-19 16:50:37 -05:00
|
|
|
getStops: function() {
|
|
|
|
return this._stops;
|
|
|
|
},
|
2011-03-03 17:45:17 -05:00
|
|
|
|
2011-02-19 16:50:37 -05:00
|
|
|
setStops: function(stops) {
|
2011-02-20 21:32:39 -05:00
|
|
|
if (stops.length < 2)
|
2011-03-03 17:45:17 -05:00
|
|
|
throw new Error(
|
|
|
|
'Gradient stop list needs to contain at least two stops.');
|
2011-02-19 16:50:37 -05:00
|
|
|
this._stops = stops;
|
|
|
|
}
|
2011-03-03 11:32:55 -05:00
|
|
|
});
|