Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stagger() function not recognized in anime js

I just started using animeJS and it's a nice library.

However, I wanted to make use of the stagger function, as found in the documentation and my console is giving me the following message when I want to use the stagger function.

"anime.stagger is not a function"

So, I am wondering if the cdn that I am using might be outdated or I missed something else along the way. Otherwise the code I had, until wanting to use the stagger function, is working.

        <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <link rel="stylesheet" href="main.css">
      <title>Document</title>
    </head>
    <body>

      <h1>Design for Grid</h1>

      <section>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
      </section>




      <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.2.0/anime.js"></script>


      <script> 

      let tl = anime.timeline({
        easing: 'easeOutExpo',
        duration: 750
      });

      //Add children
      tl.add({
        targets: 'section div',
        backgroundColor: 'rgb(111,193, 243)',
        delay: anime.stagger(300)
    })


        </script>
      </body>
    </html>
like image 578
Dan Avatar asked May 09 '26 13:05

Dan


1 Answers

I had the same problem. I fixed it by downloading and using the newest version: 3.0.1. You can find it here.

like image 68
JCB90 Avatar answered May 12 '26 03:05

JCB90