問題描述
如何通過“raphael-svg-import”加載和顯示 SVG 數據? (How to load and display SVG data by "raphael-svg-import"?)
(using Raphael_2.01, WindowsXP, Firefox12.0)
Hello folks,
I can't load and display a SVG data by "raphael-svg-import" :(
I've made a SVG shape data by "Adobe FlashCS5" and "Adobe Wallaby" and checked it by Inkscape-ver0.46.
The shape is blue-gradient ball. Please see http://kie.nu/af2 .
With the sample of https://github.com/wout/raphael-svg-import , I wrote the html and Raphael code:
window.onload = function () {
paper = Raphael(0, 0, 800, 600);
paper.importSVG(SVG_data);// <======================= (* **)
}
The svg code can be viewed at http://pastebin.com/Dz1N8iiz or http://jsfiddle.net/crazytonyi/ucWUh/
When I ran the sample code of "raphael-svg-import"(Purple paint on a rectangle), it succeeded. But using above SVG data, Firefox doesn't show anything :(
What Should I do ?
Thanks. Crane@Japan
參考解法
方法 1:
I guess that the function "importSVG()" can't take the argument which includes gradation parameters.
I've checked several SVG codes. When they have path and simple paint information, "importSVG()" can ran normally. But one of them includes color gradation parameters, no shape appears.
So I think when we want to draw gradation shapes we must use the Raphael's gradient settings.
(for example: “r(0.25, 0.75)#fff-#000”)