HTML / CSS Animation funktioniert nicht?

1 Antwort

du darfst das Object nicht jedesmal überschreiben, sondern brauchst für jede Animation eins.

Statt mehrfach:

let el = document.querySelector('#solar_icon');
let myAnimation = new LazyLinePainter(...etc...); 
myAnimation.paint(); 

eher

let el = document.querySelector('#solar_icon');
let myAnimation = new LazyLinePainter(...etc...); 
myAnimation.paint();
let el2 = document.querySelector('#xxx_icon');
let myAnimation2 = new LazyLinePainter(...etc...); 
myAnimation2.paint(); 
let el3 = document.querySelector('#yyy_icon');
let myAnimation3 = new LazyLinePainter(...etc...); 
myAnimation3.paint(); 

Maximale Erfolge!

romeosanto 
Fragesteller
 21.04.2022, 10:21

Hallo Elmex7

Vielen Dank für die Hilfe, leider wird immer noch nur 1 Animation animiert. Habe ich es richtig eingefügt:

 

 <script type="text/javascript">

     (function(){ 

      document.onreadystatechange = () => {

       if (document.readyState === 'complete') {

 

        /**

         * Setup your Lazy Line element.

         * see README file for more settings

         */

        let el = document.querySelector('#solar_icon');

        let myAnimation = new LazyLinePainter(el, {"ease":"easeLinear","strokeWidth":4,"strokeOpacity":1,"strokeColor":"#FFFFFF","strokeCap":"square","delay":300}); 

myAnimation.paint(); 

  

let el2 = document.querySelector('#house_icon');

        let myAnimation2 = new LazyLinePainter(el, {"ease":"easeLinear","strokeWidth":3,"strokeOpacity":1,"strokeColor":"#222F3D","strokeCap":"square","delay":230});    

        myAnimation2.paint(); 

       }

      }

     })();

    </script>

0
romeosanto 
Fragesteller
 21.04.2022, 15:02

Hallo Elmex7

Vielen Dank für die Hilfe, leider wird immer noch nur 1 Animation animiert. Habe ich es richtig eingefügt:

 

 <script type="text/javascript">

     (function(){ 

      document.onreadystatechange = () => {

       if (document.readyState === 'complete') {

 

        /**

         * Setup your Lazy Line element.

         * see README file for more settings

         */

        let el = document.querySelector('#solar_icon');

        let myAnimation = new LazyLinePainter(el, {"ease":"easeLinear","strokeWidth":4,"strokeOpacity":1,"strokeColor":"#FFFFFF","strokeCap":"square","delay":300}); 

myAnimation.paint(); 

  

let el2 = document.querySelector('#house_icon');

        let myAnimation2 = new LazyLinePainter(el, {"ease":"easeLinear","strokeWidth":3,"strokeOpacity":1,"strokeColor":"#222F3D","strokeCap":"square","delay":230});   

        myAnimation2.paint(); 

       }

      }

     })();

    </script>

0
elmex7  21.04.2022, 15:07
@romeosanto

Bei 2. new LazyLinePainter(el,..) muss es dann auch new LazyLinePainter(el2,...) sein...

0