javascript - 检查 SVG 中的动画何时结束

标签 javascript html svg

我正在 SVG 中启动一个动画,当它结束时我想知道,以便我可以执行另一个函数。我尝试过 endEvent="endAnimate()" 但没有任何反应。可以检查动画何时结束,如果是,我可以调用另一个函数吗?

最佳答案

根据文档,动画元素有 onend您可以使用的事件。

animation event attribute

An animation event attribute is an event attribute that specifies script to run for a particular animation-related event. See Animation event attributes. The animation event attributes are ‘onbegin’, ‘onend’, ‘onload’ and ‘onrepeat’.

因此,如果您确实想将其附加到动画元素,您可以像 onend="endAnimate()" 一样使用它

关于javascript - 检查 SVG 中的动画何时结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16482923/

相关文章:

css - HTML/CSS - DIV 元素在不应该隐藏的时候隐藏了?

jquery - 如何在动态添加和删除textarea时避免与其他元素重叠?

animation - 动画化SVG渐变

javascript - 如何向 Raphael.js 对象添加阴影?

javascript - 如何使用 jQuery 等待来自回调的异步调用?

javascript - 在这种情况下单击按钮时如何显示指示器

javascript - AngularJs 表中的 ng-if 内的 ng-repeat

html - 内联 CSS 元素没有空格

javascript - 图案填充 svg 和颜色选择器

javascript - 加载外部 JavaScript 文件