jointjs
Version:
JavaScript diagramming library
14 lines (12 loc) • 692 B
HTML
<p>The <code>fill</code> attribute becomes a special attribute only in case it's defined as an object, instead of the usual SVG syntax (e.g. <code>"#ffaabb"</code>).
If it's defined as an object, it is assumed to be a gradient definition and must have the form defined by the <a href="#dia.Paper.prototype.defineGradient">defineGradient()</a> paper method.</p>
<pre><code>element.attr('rect/fill', {
type: 'linearGradient',
stops: [
{ offset: '0%', color: '#E67E22' },
{ offset: '20%', color: '#D35400' },
{ offset: '40%', color: '#E74C3C' },
{ offset: '60%', color: '#C0392B' },
{ offset: '80%', color: '#F39C12' }
]
});</code></pre>