我希望向从After Effects导出的SVG添加mouseover事件。我想让SVG在mouseover上播放。到目前为止,我已经尝试了animation-play-state属性,但它没有起作用。我还尝试在脚本中使用onmouseover,并尝试为mouseover添加事件侦听器,但仍然没有结果。我做错了什么?
var params = {
container: document.getElementById('bodymovin'),
renderer: 'svg',
loop: true,
autoplay: true,
animationData: animationData
};
var anim;
anim = bodymovin.loadAnimation(params);发布于 2016-06-01 18:44:57
我这样做,它对我来说是有效的:
animContainer = document.getElementById('bodymovin');
var params = {
container: animContainer,
renderer: 'svg',
loop: true,
autoplay: true,
autoplay:false,
autoloadSegments: false,
path: 'data.json'// path to your data.json file you rendered from AE
};
var anim;
anim = bodymovin.loadAnimation(params);
animContainer.addEventListener("mouseover", myScript);
function myScript(){
anim.play();
}https://stackoverflow.com/questions/36869593
复制相似问题