2011-03-07 00:50:44 +00: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.
|
2011-03-08 01:41:50 +00:00
|
|
|
* http://paperjs.org/
|
2011-03-07 00:50:44 +00:00
|
|
|
* http://scriptographer.org/
|
|
|
|
*
|
2011-03-08 01:41:50 +00:00
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
2011-03-07 00:50:44 +00:00
|
|
|
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
|
|
|
|
* http://lehni.org/ & http://jonathanpuckey.com/
|
|
|
|
*
|
2011-03-08 01:41:50 +00:00
|
|
|
* All rights reserved.
|
2011-03-07 00:50:44 +00:00
|
|
|
*/
|
|
|
|
|
2011-03-04 13:34:31 +00:00
|
|
|
var Gradient = this.Gradient = Base.extend({
|
2011-03-05 01:26:12 +00:00
|
|
|
beans: true,
|
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
initialize: function() {
|
2011-03-05 01:26:12 +00:00
|
|
|
this.setStops([
|
2011-03-03 22:45:17 +00:00
|
|
|
new GradientStop('white', 0),
|
2011-03-05 01:26:12 +00:00
|
|
|
new GradientStop('black', 1)]);
|
2011-02-19 22:50:37 +01:00
|
|
|
this.type = 'linear';
|
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
getStops: function() {
|
|
|
|
return this._stops;
|
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
setStops: function(stops) {
|
2011-02-21 03:32:39 +01:00
|
|
|
if (stops.length < 2)
|
2011-03-03 22:45:17 +00:00
|
|
|
throw new Error(
|
|
|
|
'Gradient stop list needs to contain at least two stops.');
|
2011-02-19 22:50:37 +01:00
|
|
|
this._stops = stops;
|
|
|
|
}
|
2011-03-03 16:32:55 +00:00
|
|
|
});
|