WixAnimation - Timeline not initiated!

Came around with the same problem, here’s my solution:

import wixAnimations from 'wix-animations';
let isBundleVisible= false;
const obj=[wixAnimations.timeline()]

//This is the box that's being animated
export function box15_click(event) {
    obj[0]=wixAnimations.timeline()
    if (!isBundleVisible){
            obj[0].add($w('#box15'), {y: 60, duration: 700, easing: 'easeInOutQuad'})
        obj[0].play()
        isBundleVisible=true;
        return;
    }
    obj[0].add($w('#box15'), {y: 0, duration: 700, easing: 'easeInOutQuad'})
    obj[0].play();
    isBundleVisible=false;
}
/*Everytime i change the state, the reference to that timeline inside "obj" on index 0 is cleaned, the isBundleVisible variable is also set to false, due to the animated object being on it's initial position when the stateBox is changed*/
export function statebox14_change(event) {
    isBundleVisible= false;
    obj[0]=undefined
}

If u need any helpl, feel free to comment