'Im trying to make the effect loop with a 'while' and its not working

// API Reference: https://www.wix.com/velo/reference/api-overview/introduction // “Hello, World!” Example: https://learn-code.wix.com/en/article/1-hello-world

import { timeline } from 'wix-animations';

$w.onReady(function () {
 var rotate = true;

 let timeline1 = timeline();
 
while ($w('#image1').onMouseIn(() => {
 if (rotate == true) {
            timeline1.add($w('#box2'), { opacity: 100, duration: 800, rotate: 3600 }).play();
            rotate = false;
        } else {
            timeline1.replay();
            rotate = true;
        }
 let i=0;

});
  • Adds an event handler that runs when the element is clicked. Read more
  • @param {$w.MouseEvent} event */ export function image1_click(event) { // This function was `added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4 // Add your code for this event here: }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source