所以我在网页中嵌入了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>
Run Code Online (Sandbox Code Playgroud)