相关疑难解决方法(0)

动画在网页上旋转SVG元素

所以我在网页中嵌入了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)

html javascript graphics animation svg

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

animation ×1

graphics ×1

html ×1

javascript ×1

svg ×1