2
我有一個svg文件,我試圖在Raphael中渲染。問題在於轉型。我無法獲得規模和變革的路徑。任何人都可以告訴我,我做錯了什麼?從svg到Raphael
這裏是我的SVG的原代碼:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="1000.000000pt" height="618.000000pt" viewBox="0 0 1024 768" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" zoomAndPan="magnify" onload="javascript: init(evt);">
<g transform="translate(0.000000,309.000000) scale(0.100000,-0.100000)" fill="#cc6633" stroke="none">
<path d="M410 1078 c0 -20 -8 -32 -27 -42 -16 -9 -54 -39 -86 -68 l-58 -53 67 -75 c67 -76 78 -83 217 -140 58 -24 77 -37 77 -51 0 -11 -7 -19 -17 -19 -15 0 -16 -2 -3 -10 21 -13 53 -12 73 3 19 13 46 110 47 165 0 17 5 32 11 32 27 0 50 44 47 89 -3 39 -7 48 -30 59 -38 18 -35 39 9 80 30 27 35 35 22 42 -8 5 -90 10 -182 12 l-167 3 0 -27z" id="Allegheny" label="Allegheny" >
</path>
</g>
</svg>
這是我的拉斐爾代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Raphaël </title>
<style>
#canvas {
}
#paper {
}
#Allegheny {
}
</style>
<script src="raphael-min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
window.onload = function() {
var R = Raphael("paper", 1000, 800);
var attr = {
fill: "#ccc",
stroke: "#333",
"stroke-width": 1,
"stroke-linejoin": "round"
};
var pa = {};
pa.Allegheny = R.path("M410 1078 c0 -20 -8 -32 -27 -42 -16 -9 -54 -39 -86 -68 l-58 -53 67 -75 c67 -76 78 -83 217 -140 58 -24 77 -37 77 -51 0 -11 -7 -19 -17 -19 -15 0 -16 -2 -3 -10 21 -13 53 -12 73 3 19 13 46 110 47 165 0 17 5 32 11 32 27 0 50 44 47 89 -3 39 -7 48 -30 59 -38 18 -35 39 9 80 30 27 35 35 22 42 -8 5 -90 10 -182 12 l-167 3 0 -27z").attr(attr);
R.setViewBox(0, 0, 1024, 768, false);
R.transform(T0,309);
R.transform(s0.1);
};
</script>
</head>
<body>
<div id="canvas">
<div id="paper"></div>
<div id="Allegheny"></div>
</div>
</body>
</html>
你可以看到http://blogs.sites.post-gazette.com/demo/index.html