【发布时间】:2012-02-25 11:43:44
【问题描述】:
给定一个平坦的 100% 黑色 2D SVG 形状,我如何以任意颜色渲染它,尽可能跨浏览器?
【问题讨论】:
给定一个平坦的 100% 黑色 2D SVG 形状,我如何以任意颜色渲染它,尽可能跨浏览器?
【问题讨论】:
我会说拉斐尔是你最好的选择。
在 Raphael 中渲染 2D 颜色很容易。例如:
<script type="javascript">
// Creates canvas 320 × 200 at 10, 50
var paper = Raphael(10, 50, 320, 200);
// Creates a red-filled cross-looking shape
paper.path("M10,10L50,50M50,10L10,50").attr({stroke: "red", fill:"red"});
</script>
【讨论】: