Hi,
I'm creating an SVG rectangle using the Raphael JavaScript library, and assigning it a fill using the following line of code:
this.myBox.attr({fill: 'white'});
This works fine. However, now I want to tie this to a linear gradient. I have borrowed some gradient code to test it out, using the code below:
<defs>
<linearGradient id="orange_red" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);
stop-opacity:1"/>
<stop offset="100%" style="stop-color:rgb(255,0,0);
stop-opacity:1"/>
</linearGradient>
</defs>
And in order to assign this to the shape, I tried doing this:
this.myBox.attr({fill:url(#orange_red)});
In this case, I get the error 'Illegal character '#''.
Where am I going wrong?