title: Triggering a Lottie animation onScroll
body: <p>im currently building a website using fullpage js and lottie animations. Now im trying to trigger an animation when the user scrolls to the section with the animation. Here is what i tried:
  (please note that im very new to js)</p>
  
  <pre><code>$(document).ready(function($) {'use strict';
  
  $('#fullpage').fullpage({
  sectionsColor: ['white', '#004E8A', 'white','#004E8A', 'white', '#004E8A', 
  'white','#004E8A', 'white'],
  anchors:['startseite','pers_vermittler','team','konzept','rechner','mod_portfolio','sicherheit','absatz'],
  
  onLeave: function(index, nextIndex, direction) {
      if( index == 3 &amp;&amp; direction == 'down' ) {
      lottie.play('k2an');
    }
  </code></pre>
  
  <p>(at the end of the body section ->)</p>
  
  <pre><code>&lt;script&gt;
  var params = {
      container: document.getElementById('k2an'),
      renderer: 'svg',
      loop: true,
      autoplay: false,
      path: 'k2an.json',
  };
  
  anim = lottie.loadAnimation(params);
  </code></pre>
  
  <p></p>