Я пытаюсь оживить некоторые элементы с помощью аниме. js с некоторыми функциями обещания проблема в том, что вторая функция не запускается после успешного выполнения предыдущей.
<script>
import Splash from '../components/Splash.vue';
import Intro from '../components/Intro.vue';
export default {
components: {
Splash,
Intro,
},
mounted() {
//This is the line of the error `const animateSplash = async () => {`
const animateSplash = async () => {
const splashAnim = this.$anime({
targets: '.logo',
easing: 'cubicBezier(.5, .05, .1, .3)',
keyframes: [
{ duration: 1000, opacity: 0 },
{ duration: 1000, opacity: 1 },
{ delay: 3000, duration: 500, opacity: 0 },
],
complete(anim) {
document.querySelector('.logo-wrapper').style.display = 'none';
},
}).finished;
await Promise.all(splashAnim);
};
animateSplash().then(() => {
const introAnim = this.$anime({
targets: '.intro-wrapper',
easing: 'cubicBezier(.5, .05, .1, .3)',
keyframes: [
{ duration: 1000, opacity: 0 },
{ duration: 1000, opacity: 1 },
],
begin(anim) {
document.querySelector('.intro-wrapper').style.display = 'flex';
},
}).finished;
});
},
};
</script>
Я получаю ошибка
Home.vue?76f2:17 Uncaught (in promise) TypeError: undefined is not a function
, что снова указывает на const animateSplash = async () => {
. Но запускается первая анимация splashAnim
.