【发布时间】:2011-03-01 01:16:27
【问题描述】:
所以我在 Inkscape 中创建了一个嵌入网页的 SVG 文件,我希望它能够缓慢旋转。我尝试使用 Javascript 并将动画命令直接插入 SVG,但没有任何效果。我不想为这个任务加载整个 JS 库。这是我目前所拥有的:
<html>
<body bgcolor="#333333">
<embed src="gear.svg" id="gear" width="1000" height="1000" style="position: absolute; top: -500px; left: -500px;" />
<script type="text/javascript">
var gear = document.getElementById("gear");
window.setInterval(function() {
// Somehow animate the gear.
}, 10);
</script>
</body>
</html>
【问题讨论】:
标签: javascript html graphics animation svg