feat(main.js): improved animaton logic