简体   繁体   中英

Reset animation after scroll event

I'm using the anime.js framework to simulate leafs falling from a tree. The animation will fire when the user scrolls to the top of the page. My issue is that the animation plays only once, ie if the user scrolls down and then back up, the animation does not fire again. It may be an issue with my anime code or my javascript code.

A picture tells a thousand words - run the snippet

 //svg name space const ns = "http://www.w3.org/2000/svg" //Create new svg group and place in the dom for copies const svg = document.getElementsByTagName('svg')[0] const copyGroup = document.createElementNS(ns,'g') copyGroup.setAttribute('id','copy'); svg.appendChild(copyGroup) // Function to copy leafs to a groupd tag in the dom let leafCopy = []; function leafPicker(leafs,collection){ leafs = document.querySelectorAll(`[data-name="${collection}"]`) for(const leaf of leafs){ leafCopy.push(leaf.cloneNode(true)) } } const leafPickers = [ {leafs:"orangeLeafs", collection: "Orange"}, {leafs:"purpleLeafs", collection:"Purple"}, {leafs:"redLeafs", collection: "Red"}, {leafs:"pinkLeafs", collection:"Pink"}, {leafs:"blueLeafs", collection:"blue"}, {leafs:"greenLeafs", collection:"green"} ] for(const leafs of leafPickers){ leafPicker(leafs.leafs,leafs.collection) } function makeCopies(){ for(const copies of leafCopy){ copyGroup.appendChild(copies) const leafCopies = Array.from(document.getElementById('copy').querySelectorAll('[data-name]')) for(const [index, leafCopy] of leafCopies.entries()){ leafCopy.setAttribute('id' , `copy-${index}`) } } } makeCopies() const leafCopies = Array.from(document.getElementById('copy').querySelectorAll('[data-name]')) let spring = {}, summer = {}, autumn = {}; function shuffle(array) { var counter = array.length, temp, index; // While there are elements in the array while (counter--) { // Pick a random index index = (Math.random() * counter) | 0; // And swap the last element with it temp = array[counter]; array[counter] = array[index]; array[index] = temp; } return array; } spring = shuffle(leafCopies); spring.length = 20; // get 4 random elements summer = shuffle(leafCopies); summer.length = 40; // const summerFall = anime({ // targets : summer, // easing: 'easeInQuint', // opacity : 0, // translateY: 200, // duration: function(el,i,l){ // return 3000 + (i * 100) // } // }) window.onscroll = function(ev){ const summerFall = anime({ targets : summer, easing: 'easeInQuint', opacity : 0, translateY: 200, duration: function(el,i,l){ return 3000 + (i * 100) } }) var B= document.body; //IE 'quirks' var D= document.documentElement; //IE with doctype D= (D.clientHeight)? D: B; if (D.scrollTop == 0) { summerFall.restart() } }; makeCopies() console.log(summer.length); 
 body{ height: 200vh; } header{ max-width: 84rem; margin: 2rem auto; background: #efefef; text-align: center; padding: 1rem; position: sticky; top: 0; } .logo{ display: inline-block; width: 8rem; transform-origin: 0,0; } 
 <header role="banner"> <nav class="top"> <div class="logo"> <svg id="Times-academy" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 440.59 486.2"><defs><style>.cls-1,.cls-9{fill:#1d1d1b;}.cls-2{fill:#e8336e;}.cls-3{fill:#0073a5;}.cls-4{fill:#6fc2b6;}.cls-5{fill:#007036;}.cls-6{fill:#bc0b3b;}.cls-7{fill:#823783;}.cls-8{fill:#ec6608;}.cls-9{fill-rule:evenodd;}</style></defs><title>Times-academy</title><path id="T" class="cls-1" d="M268.79,378.46H177.56v-2.33L203,364V215.34h-.2a63,63,0,0,0-14.41,1.74,29.59,29.59,0,0,0-12.3,7.1c-5.18,4.79-32.29,32.76-32.29,32.76l-2.92-1.13,4.05-48.44H298.16l5.08,48.44-2.92,1.13s-27.1-28-32.28-32.76a29.65,29.65,0,0,0-12.3-7.1,50.29,50.29,0,0,0-12.87-1.62V364l25.84,11.9Z"/><g id="Leaf-pink"><path id="Pink" class="cls-2" d="M333.26,149.5c-7.65,9.39-2.53,22.91-2.53,22.91s14.4,2.11,22.06-7.28,5.83-27,5.83-27S340.92,140.1,333.26,149.5Z"/><path id="Pink-2" data-name="Pink" class="cls-2" d="M331.67,102c-8.73,11.65-1.92,27.64-1.92,27.64s17.42,1.84,26.15-9.82,5.68-32.66,5.68-32.66S340.41,90.28,331.67,102Z"/><path id="Pink-3" data-name="Pink" class="cls-2" d="M350.28,52.24c-8,10.68-1.76,25.33-1.76,25.33s16,1.69,24-9,5.19-29.94,5.19-29.94S358.28,41.56,350.28,52.24Z"/><path id="Pink-4" data-name="Pink" class="cls-2" d="M415.3,115.22c-6.4,5.21-4.85,14.94-4.85,14.94s9.32,3.4,15.72-1.81,7.61-17.18,7.61-17.18S421.7,110,415.3,115.22Z"/><path id="Pink-5" data-name="Pink" class="cls-2" d="M376.73,128.5c-8.47,7.85-5.46,21.26-5.46,21.26s13.3,3.88,21.77-4,9.1-24.64,9.1-24.64S385.2,120.65,376.73,128.5Z"/><path id="Pink-6" data-name="Pink" class="cls-2" d="M364.23,166.24c-6.07,3.47-6.15,11.77-6.15,11.77s7.29,4.1,13.36.63,8.77-13.27,8.77-13.27S370.31,162.77,364.23,166.24Z"/><path id="Pink-7" data-name="Pink" class="cls-2" d="M374.66,106.9c-3.28,4.11-1,9.93-1,9.93s6.25.87,9.53-3.24,2.41-11.71,2.41-11.71S377.94,102.79,374.66,106.9Z"/><path id="Pink-8" data-name="Pink" class="cls-2" d="M403.35,148.19c-5.73,3.27-5.82,11.09-5.82,11.09s6.87,3.88,12.6.61,8.29-12.5,8.29-12.5S409.08,144.93,403.35,148.19Z"/></g><g id="Leafs-blue"><path id="blue" class="cls-3" d="M152.77,121c2.49,14.31-10.86,25.54-10.86,25.54s-16.38-6.15-18.87-20.45,9.79-31.7,9.79-31.7S150.28,106.65,152.77,121Z"/><path id="blue-2" data-name="blue" class="cls-3" d="M171.72,95.46c-2.35,5.22-9.19,6-9.19,6s-4-5.55-1.65-10.77,10.2-8.22,10.2-8.22S174.06,90.25,171.72,95.46Z"/><path id="blue-3" data-name="blue" class="cls-3" d="M108.92,102c8.73,11.65,1.92,27.64,1.92,27.64s-17.41,1.84-26.14-9.82S79,87.11,79,87.11,100.19,90.28,108.92,102Z"/><path id="blue-4" data-name="blue" class="cls-3" d="M90.31,52.24c8,10.68,1.77,25.33,1.77,25.33s-16,1.69-24-9-5.2-29.94-5.2-29.94S82.31,41.56,90.31,52.24Z"/><path id="blue-5" data-name="blue" class="cls-3" d="M154.05,48c5.6,13.41-4.94,27.31-4.94,27.31s-17.34-2.37-22.93-15.78,2.54-33.07,2.54-33.07S148.46,34.58,154.05,48Z"/><path id="blue-6" data-name="blue" class="cls-3" d="M189.89,129c2.81,10.4-6.24,19.68-6.24,19.68S171.2,145.3,168.4,134.9s5-24.14,5-24.14S187.09,118.57,189.89,129Z"/><path id="blue-7" data-name="blue" class="cls-3" d="M122,71.94c5.65,7.8,1,18.29,1,18.29s-11.54,1-17.18-6.78-3.38-21.66-3.38-21.66S116.36,64.13,122,71.94Z"/><path id="blue-8" data-name="blue" class="cls-3" d="M162.34,185.13c8,10.06,23.31,7.84,23.31,7.84s5.6-14.42-2.4-24.48-26.76-12.19-26.76-12.19S154.34,175.06,162.34,185.13Z"/></g><g id="Leafs-green"><path id="green" class="cls-4" d="M108.66,148.17c7.66,9.39,2.54,22.91,2.54,22.91s-14.4,2.11-22.06-7.28-5.83-27-5.83-27S101,138.77,108.66,148.17Z"/><path id="green-2" data-name="green" class="cls-5" d="M93.18,237c13.82-10.12,32.73-2.15,32.73-2.15s2.13,20.26-11.69,30.38-38.69,6.52-38.69,6.52S79.35,247.14,93.18,237Z"/><path id="green-3" data-name="green" class="cls-5" d="M40.06,228.54c7.63-5.6,18.08-1.19,18.08-1.19s1.17,11.19-6.46,16.78-21.37,3.6-21.37,3.6S32.42,234.14,40.06,228.54Z"/><path id="green-4" data-name="green" class="cls-4" d="M34.91,170.23c14.65.24,23.29,15.34,23.29,15.34s-9.13,14.8-23.78,14.57S4.83,184.71,4.83,184.71,20.26,170,34.91,170.23Z"/><path id="green-5" data-name="green" class="cls-4" d="M25.3,115.22c6.39,5.21,4.84,14.94,4.84,14.94s-9.32,3.4-15.72-1.81-7.61-17.18-7.61-17.18S18.89,110,25.3,115.22Z"/><path id="green-6" data-name="green" class="cls-5" d="M49.87,261.35c6.25-5.39,15.56-2.16,15.56-2.16s1.72,9.77-4.53,15.16-18.25,4.48-18.25,4.48S43.62,266.74,49.87,261.35Z"/><path id="green-7" data-name="green" class="cls-4" d="M63.86,128.5c8.47,7.85,5.46,21.26,5.46,21.26s-13.29,3.88-21.76-4-9.11-24.64-9.11-24.64S55.39,120.65,63.86,128.5Z"/><path id="green-8" data-name="green" class="cls-5" d="M69.47,234.4c4.5-3.29,10.65-.7,10.65-.7s.7,6.59-3.8,9.89-12.59,2.11-12.59,2.11S65,237.69,69.47,234.4Z"/><path id="green-9" data-name="green" class="cls-5" d="M142.75,171.54c5.65,7.81,1,18.31,1,18.31s-11.54,1-17.18-6.79-3.38-21.66-3.38-21.66S137.11,163.74,142.75,171.54Z"/><path id="green-10" data-name="green" class="cls-4" d="M76.36,166.24c6.08,3.47,6.16,11.77,6.16,11.77s-7.3,4.1-13.37.63-8.76-13.27-8.76-13.27S70.29,162.77,76.36,166.24Z"/><path id="green-11" data-name="green" class="cls-4" d="M65.94,106.9c3.27,4.11,1,9.93,1,9.93s-6.25.87-9.53-3.24S55,101.88,55,101.88,62.66,102.79,65.94,106.9Z"/><path id="green-12" data-name="green" class="cls-4" d="M37.25,148.19c5.73,3.27,5.82,11.09,5.82,11.09s-6.87,3.88-12.61.61-8.28-12.5-8.28-12.5S31.51,144.93,37.25,148.19Z"/><path id="green-13" data-name="green" class="cls-4" d="M13.19,209.27c8.32-3.62,17.12,2.67,17.12,2.67s-1.28,10.7-9.6,14.32S0,225.14,0,225.14,4.87,212.89,13.19,209.27Z"/><path id="green-14" data-name="green" class="cls-5" d="M82.25,184.9c14.91-2.91,27,10.55,27,10.55s-6,17-20.94,19.9-33.4-9.3-33.4-9.3S67.34,187.82,82.25,184.9Z"/><path id="green-15" data-name="green" class="cls-5" d="M130.12,216.23c5.81-4.67,4.49-13.54,4.49-13.54s-8.38-3.2-14.19,1.46-7,15.54-7,15.54S124.3,220.9,130.12,216.23Z"/></g><g id="Leaf-red"><path id="Red" class="cls-6" d="M259.52,36.46c-1.36,8.14,6.23,14.41,6.23,14.41s9.25-3.61,10.61-11.75S270.7,21.2,270.7,21.2,260.87,28.31,259.52,36.46Z"/><path id="Red-2" data-name="Red" class="cls-6" d="M284.49,120.93c-2.49,14.31,10.86,25.54,10.86,25.54s16.38-6.15,18.87-20.45-9.8-31.7-9.8-31.7S287,106.62,284.49,120.93Z"/><path id="Red-3" data-name="Red" class="cls-6" d="M286.54,48C281,61.4,291.49,75.3,291.49,75.3s17.33-2.37,22.92-15.78-2.54-33.07-2.54-33.07S292.14,34.58,286.54,48Z"/><path id="Red-4" data-name="Red" class="cls-6" d="M297.84,171.54c-5.65,7.81-.95,18.31-.95,18.31s11.53,1,17.17-6.79,3.39-21.66,3.39-21.66S303.49,163.74,297.84,171.54Z"/><path id="Red-5" data-name="Red" class="cls-6" d="M251.8,129.83c3.94,8.77,15.45,10.06,15.45,10.06s6.72-9.35,2.77-18.13-17.15-13.83-17.15-13.83S247.85,121.06,251.8,129.83Z"/><path id="Red-6" data-name="Red" class="cls-6" d="M268.84,95.46c2.35,5.22,9.19,6,9.19,6s4-5.55,1.64-10.77-10.19-8.22-10.19-8.22S266.5,90.25,268.84,95.46Z"/><path id="Red-7" data-name="Red" class="cls-6" d="M318.59,71.94c-5.64,7.8-.95,18.29-.95,18.29s11.53,1,17.17-6.78,3.38-21.66,3.38-21.66S324.23,64.13,318.59,71.94Z"/><path id="Red-8" data-name="Red" class="cls-6" d="M271.2,185.74c-7.15,10.26-21.56,7.42-21.56,7.42s-5.73-15.3,1.42-25.57,24.64-11.85,24.64-11.85S278.36,175.46,271.2,185.74Z"/></g><g id="Leafs-purple"><path id="Purple" class="cls-7" d="M235.63,118.16c2.28,16.63-13.61,29-13.61,29s-18.65-7.77-20.92-24.39,12.63-36.19,12.63-36.19S233.36,101.53,235.63,118.16Z"/><path id="Purple-2" data-name="Purple" class="cls-7" d="M230.43,29.13C230.86,43.65,216,52.89,216,52.89S200.7,44.52,200.27,30s14.2-30,14.2-30S230,14.62,230.43,29.13Z"/><path id="Purple-3" data-name="Purple" class="cls-7" d="M181.08,36.46c1.36,8.14-6.24,14.41-6.24,14.41s-9.24-3.61-10.6-11.75S169.9,21.2,169.9,21.2,179.72,28.31,181.08,36.46Z"/><path id="Purple-4" data-name="Purple" class="cls-7" d="M199.63,72.85c-.27,9.61-10.4,15.11-10.4,15.11s-9.8-6.16-9.53-15.77S190.21,53,190.21,53,199.89,63.24,199.63,72.85Z"/><path id="Purple-5" data-name="Purple" class="cls-7" d="M229.93,69.31c-2.34,5.22-9.18,6-9.18,6s-4-5.56-1.65-10.78,10.2-8.23,10.2-8.23S232.28,64.1,229.93,69.31Z"/><path id="Purple-6" data-name="Purple" class="cls-7" d="M240.74,74.22c-3,9.14,4.7,17.73,4.7,17.73s11.31-2.5,14.29-11.64-3.43-21.66-3.43-21.66S243.72,65.09,240.74,74.22Z"/><path id="Purple-7" data-name="Purple" class="cls-7" d="M219.65,172.49c4.2,10.33-4,21-4,21s-13.28-1.91-17.48-12.23,2.17-25.41,2.17-25.41S215.44,162.16,219.65,172.49Z"/><path id="Purple-8" data-name="Purple" class="cls-7" d="M242,164c-4.06,5.25-12,4.21-12,4.21s-3-7.41,1.06-12.66,13.73-6.47,13.73-6.47S246.05,158.74,242,164Z"/></g><g id="Leafs-orange"><path id="Orange" class="cls-8" d="M347.42,237c-13.82-10.12-32.73-2.15-32.73-2.15s-2.14,20.26,11.69,30.38,38.68,6.52,38.68,6.52S361.25,247.14,347.42,237Z"/><path id="Orange-2" data-name="Orange" class="cls-8" d="M400.54,228.54c-7.64-5.6-18.08-1.19-18.08-1.19s-1.18,11.19,6.45,16.78,21.37,3.6,21.37,3.6S408.18,234.14,400.54,228.54Z"/><path id="Orange-3" data-name="Orange" class="cls-8" d="M405.68,170.23c-14.64.24-23.29,15.34-23.29,15.34s9.14,14.8,23.78,14.57,29.59-15.43,29.59-15.43S420.33,170,405.68,170.23Z"/><path id="Orange-4" data-name="Orange" class="cls-8" d="M390.72,261.35c-6.25-5.39-15.56-2.16-15.56-2.16s-1.71,9.77,4.54,15.16S398,278.83,398,278.83,397,266.74,390.72,261.35Z"/><path id="Orange-5" data-name="Orange" class="cls-8" d="M371.12,234.4c-4.5-3.29-10.64-.7-10.64-.7s-.7,6.59,3.8,9.89,12.58,2.11,12.58,2.11S375.62,237.69,371.12,234.4Z"/><path id="Orange-6" data-name="Orange" class="cls-8" d="M427.41,209.27c-8.33-3.62-17.12,2.67-17.12,2.67s1.28,10.7,9.6,14.32,20.7-1.12,20.7-1.12S435.72,212.89,427.41,209.27Z"/><path id="Orange-7" data-name="Orange" class="cls-8" d="M358.35,184.9c-14.92-2.91-27,10.55-27,10.55s6,17,20.93,19.9,33.4-9.3,33.4-9.3S373.26,187.82,358.35,184.9Z"/><path id="Orange-8" data-name="Orange" class="cls-8" d="M310.25,216.19c-5.81-4.67-4.47-13.54-4.47-13.54s8.39-3.19,14.19,1.48,7,15.56,7,15.56S316.06,220.87,310.25,216.19Z"/></g><g id="theTimes"><path id="t-2" data-name="t" class="cls-9" d="M123.5,441.85H106.9v-.42l4.63-2.2V412.16h0a11.54,11.54,0,0,0-2.62.32,5.32,5.32,0,0,0-2.24,1.29c-.94.87-5.88,6-5.88,6l-.53-.2.74-8.82h27.89l.93,8.82-.54.2s-4.93-5.09-5.87-6a5.38,5.38,0,0,0-2.24-1.29,9.27,9.27,0,0,0-2.34-.3v27.05l4.7,2.16Z"/><polygon id="h" class="cls-9" points="163.24 413.34 167.03 411.17 167.04 410.71 152.25 410.71 152.25 411.13 156.08 413.28 156.08 424.88 141.87 424.98 141.87 413.34 145.66 411.17 145.67 410.71 130.88 410.71 130.88 411.13 134.71 413.32 134.71 439.28 130.88 441.43 130.88 441.85 145.67 441.85 145.66 441.39 141.87 439.23 141.87 426.72 156.08 426.82 156.08 439.28 152.25 441.43 152.25 441.85 167.04 441.85 167.03 441.39 163.24 439.23 163.24 413.34"/><path id="e" class="cls-9" d="M194.88,441.85H168.41v-.42l3.82-2.15v-26l-3.82-2.19v-.42H194l.56,8.14-.47.16s-4.1-4.24-5-5.11a5.31,5.31,0,0,0-2.24-1.3,11.22,11.22,0,0,0-2.62-.31l-4.69-.15V425.3s4.91-.08,5.45-.15c.75-.09,1-.09,2.06-1.28.84-1,2.17-2.71,2.17-2.71h.55v10.43h-.55s-2.58-3.76-2.78-3.89a2.53,2.53,0,0,0-2-.7c-1.35,0-4.95-.09-4.95-.09v13.43s2.8,0,5.05-.15,3.49-.24,5-1.48,5.35-5.78,5.35-5.78l.59.19Z"/><path id="t-3" data-name="t" class="cls-9" d="M228.44,441.85h-16.6v-.42l4.63-2.2V412.16h0a11.49,11.49,0,0,0-2.62.32,5.26,5.26,0,0,0-2.24,1.29c-.94.87-5.88,6-5.88,6l-.53-.2.74-8.82h27.89l.92,8.82-.53.2s-4.93-5.09-5.88-6a5.3,5.3,0,0,0-2.23-1.29,9.27,9.27,0,0,0-2.34-.3v27.05l4.7,2.16Z"/><polygon id="i" class="cls-9" points="239.61 439.28 235.78 441.42 235.78 441.85 250.57 441.85 250.56 441.39 246.77 439.22 246.77 413.33 250.56 411.16 250.57 410.7 235.78 410.7 235.78 411.13 239.61 413.27 239.61 439.28"/><path id="e-2" data-name="e" class="cls-9" d="M321.89,433.12l-.58-.19s-3.88,4.54-5.36,5.78-2.71,1.28-5,1.48-5,.15-5,.15l0-13.43s3.6.11,5,.09a2.56,2.56,0,0,1,2,.7c.19.13,2.78,3.89,2.78,3.89h.54V421.16h-.54s-1.33,1.74-2.17,2.71c-1,1.19-1.32,1.19-2.06,1.28-.54.07-5.46.15-5.46.15l0-13.16,4.68.15a11.28,11.28,0,0,1,2.63.31,5.43,5.43,0,0,1,2.24,1.3c.94.87,5,5.11,5,5.11l.47-.16-.56-8.14H294.87v.42l3.83,2.19v26l-3.83,2.15v.42h26.48Z"/><polygon id="m" class="cls-9" points="273.67 432.03 283.16 410.7 293.54 410.7 293.53 411.16 289.75 413.33 289.75 439.22 293.53 441.39 293.54 441.85 278.77 441.85 278.77 441.42 282.6 439.28 282.6 417.13 271.41 441.42 270.06 441.42 258.13 416.63 258.13 439.22 261.92 441.39 261.93 441.85 251.99 441.85 251.99 441.42 255.82 439.28 255.82 413.27 251.99 411.13 251.99 410.7 263.23 410.7 273.67 432.03"/><path id="s" class="cls-9" d="M343,411.14l.58,7.69-.51.1s-5.32-5.8-5.94-6.28a4.66,4.66,0,0,0-5.51-.14,3.82,3.82,0,0,0-.94,5.08c1.68,3.3,6.66,5.63,7.93,6.39s7.63,3.85,6.83,10.15c-.76,5.94-6.07,7.65-8.28,8.07-4.7.89-12-1.1-12-1.1l-.55-8.06.62-.07s5.31,6.35,7.41,7.14,5,1.06,6.69-1.13.29-5.3-1.41-6.46c-2.4-1.64-5.89-3.49-8.33-5.11a10.48,10.48,0,0,1-4.85-7.45,8.4,8.4,0,0,1,5.15-8.89,15.72,15.72,0,0,1,7.52-.79A47.16,47.16,0,0,1,343,411.14Z"/></g><g id="Academy"><path id="a" class="cls-1" d="M100.47,485.45l11-30.3h1.2l10.86,30.3v.61h-.66l-3.76-10.37H104.84l-3.75,10.37h-.62Zm4.64-10.51h13.73L112.08,456H112Z"/><path id="c" class="cls-1" d="M136.85,470.48c0-10.29,6.23-15.46,13.17-15.46,5,0,7.19,1.59,9.44,3.62v.75h-.61c-1.73-2.07-4.15-3.62-8.79-3.62-6.76,0-12.32,4.9-12.32,14.66s4.81,15,12,15c4.9,0,7.86-1.82,9.67-4.2H160V482a13.06,13.06,0,0,1-10.29,4.2C142.29,486.2,136.85,480.72,136.85,470.48Z"/><path id="a-2" data-name="a" class="cls-1" d="M172.67,485.45l11-30.3h1.19l10.87,30.3v.61h-.66l-3.76-10.37H177l-3.76,10.37h-.61Zm4.63-10.51H191L184.28,456h-.09Z"/><path id="d" class="cls-1" d="M210.82,455.15h7.77c10.16,0,15.32,4.33,15.32,15.46s-5.16,15.45-15.32,15.45h-7.77Zm7.77,30.12c9.76,0,14.44-4,14.44-14.66S228.35,456,218.59,456H211.7v29.32Z"/><path id="e-3" data-name="e" class="cls-1" d="M249.63,455.15h17.84v.75h-17v13.74h12.94v.75H250.52v14.92h17.57v.75H249.63Z"/><path id="m-2" data-name="m" class="cls-1" d="M283.28,455.15h1.77l11.66,29.68h0l11.66-29.68h1.72v30.91h-.88V455.81H309L297.1,486.06h-.83l-11.88-30.25h-.22v30.25h-.89Z"/><path id="y" class="cls-1" d="M335.08,486.06v-13.2L325,455.73v-.58h.61l9.94,16.92h0l10-16.92h.58v.58L336,472.86v13.2Z"/></g></svg> </div> </nav> </header> <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.2.0/anime.min.js"></script> 

try with: loop: true

window.onscroll = function(ev){
  const summerFall = anime({
  targets : summer,
  easing: 'easeInQuint',
  opacity : 0,
  translateY: 200,
  loop: true, // add this property
  duration: function(el,i,l){
    return 3000 + (i * 100)
  }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM