このチュートリアルで Raphael.js を学習しています: http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/しかし、パス (セクション 4) でブロックされました)。ここに私のテストコードがあります:
<html>
<head>
<title>Raphael Play</title>
<script type="text/javascript" src="js/raphael-min.js"></script>
<script type="text/javascript">
window.onload = function() {
var paper = new Raphael(document.getElementById('canvas_container'), 500, 500);
var tetronimo = paper.path("M 250 250 l 0 -50 l -50 0 l 0 -50 l -50 0 l 0 50 l -50 0 l 0 50 z");
}
</script>
<style type="text/css">
#canvas_container {
width: 500px;
border: 1px solid #aaa;
}
</style>
</head>
<body>
<div id="canvas_container"></div>
</body>
</html>
何らかの理由でパスが空になります:
<svg height="500" version="1.1" width="500" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;">
<desc>Created with Raphaël 2.1.0</desc>
<defs/>
<path style="" fill="none" stroke="#000000" d=""/>
</svg>
d="" パラメータに手作りのパスを入れてみましたが、うまくいきませんでした。OSX 上の FF と Chrome の両方でテスト済み。
ご協力いただきありがとうございます。