hi guys,
I’m having problem with setting up lottie player on my website. On the click of a button I want to play specific segment of animation, but on first click animation is playing in full before playing selected segment, after that next click is doing what I expect and plays only the selected frames. Below you’ll find my configuration
<button id="button">Click me</button>
<lottie-player
id="Lottie"
src="animation.json"
background="transparent"
speed="1"
style="width: 300px; height: 300px;">
</lottie-player>
<script src="lottie-player.js"></script>
<script>
var lottiePlayer = document.getElementById('Lottie');
var lottie = lottiePlayer.getLottie();
var button = document.getElementById('button');
button.addEventListener('click', runAnimation);
function runAnimation() {
lottie.playSegments([48, 72]);
}
</script>
I’d appreciate any help