'Color gradient renders as black
I'm attempting to use paper.js with javascript directly: http://paperjs.org/tutorials/getting-started/using-javascript-directly/
and cannot get gradients to work. Instead of a color gradient the line just appears to be black. This occurs for all shapes, so I'm pretty sure I'm somehow setting up paper.js incorrectly. Any help would be appreciated!
Here's an example codeblock:
paper.install(window);
window.onload = function() {
// Setup directly from canvas id:
paper.setup('myCanvas');
var path = new Path();
path.strokeColor = {
gradient: {
stops: ['blue', 'red']
},
origin: new Point(350, 0),
destination: new Point(0, 350)
};
path.strokeWidth = 5;
path.add(new Point(350, 0));
path.add(new Point(0, 350));
view.draw();
}
jsfiddle: https://jsfiddle.net/3p1sr68n/2/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
