Play segments on hover

To loop certain segments on hover, ensure that the Lottie is already at the frame you want to start the on hover loop from (Check the javascript code to find out how). Once that's done you can use the library's "hover" action to loop the segment.
<script>
LottieInteractivity.create({
    player: "#firstLottie",
    mode:"cursor",
    actions: [
        {
            position: { x: [0, 1], y: [0, 1] },
            type: "loop",
            frames: [45, 60]
        },
        {
            position: { x: -1, y: -1 },
            type: 'stop',
            frames: [0],
        }
    ]
});
</script>



Updated

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.