小编pha*_*gie的帖子

Bodymovin只悬停播放一次动画

让我的动画在悬停时触发播放.我把一切都搞定了,但是当我试图再次盘旋时,似乎没有任何效果.

我写错了什么想法?

var squares = document.getElementById("test");
var animation = bodymovin.loadAnimation({
    container: test,
    renderer: "svg",
    loop: false,
    autoplay: false,
    path: "https://dl.dropboxusercontent.com/BodyMovin/squares.json"
});

squares.addEventListener("mouseenter", function () {
    animation.play();
});

function playAnim(anim, loop) {
    if(anim.isPaused) {
        anim.loop = loop;
        anim.goToAndPlay(0);
    }
}

function pauseAnim(anim) {
    if (!anim.isPaused) {
        anim.loop = false;
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript jquery animation bodymovin

10
推荐指数
2
解决办法
2087
查看次数

标签 统计

animation ×1

bodymovin ×1

javascript ×1

jquery ×1