English 中文(简体)
使用 JavaScript 控制 SVG s SMIL 和 JavaScript 控制 SVG s SMIL
原标题:Controlling SVG s SMIL with JavaScript

s让我们假设我有一个昆虫的 SVG。 除非无法以这种方式插入 标签。

现在, insect. svg 有两种动画:一种是步行动画,另一种是飞行动画。

我想单独开始/停止这些动画, 或者从 HTML s JavaScript (或者从 HTML JavaScript 中称为嵌入的 SVG JS 函数“行走”或“飞行 ” 。

所以,最后,如果在游戏中我想让我的昆虫飞翔, 我可以告诉它和联署材料一起飞翔, 并告诉它当它应该停止飞翔的时候停止飞翔。和走路一样。

Is there any way to do this? I ve been Googling for the past hour and made no real findings. I don t care about IE support if that is an issue.

感谢您抽出时间!

最佳回答

您可以尝试使用 SMIL 动画超链接 。 您可以在 URL 上的 # 之后将您想要开始的动画的代号设置为 。 见 < a href=" http://www.w3. org/ Graphics/SVG/Test/ 20061213/ htmlObjectHarness/ full- animate- elm- 21- t.html" rel= "nofolve noreferrerr" > http://www.w3. org/Graphics/SVG/Test/ 20061213/htmlObjectHarness/ full- animate- elem- 21- t.html - 例如当鼠标点击鼠标并启动动画时, URL会更改 。

不然的话,如果你想用标本开始动画......它就会变成这样...

var svgDocument = document.getElementById("objectId>").getSVGDocument();
svgDocument.getElementById( <animationElementId> ).beginElement();

但是,由于不允许脚本,这将无法使用 元素 。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签