diff --git a/docs/components/home/flows/Intro.vue b/docs/components/home/flows/Intro.vue index a46c0882..96b44e99 100644 --- a/docs/components/home/flows/Intro.vue +++ b/docs/components/home/flows/Intro.vue @@ -216,6 +216,29 @@ const scrollTo = () => { el.scrollIntoView({ behavior: 'smooth' }) } } + +const animationClassNames = ['checker-gb', 'checker-op', 'checker-yg', 'checker-ss'] + +const shuffle = (a: any[]) => { + for (let i = a.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)) + ;[a[i], a[j]] = [a[j], a[i]] + } + return a +} + +const createAnimationDurations = () => { + return animationClassNames.map((className) => { + const duration = Math.random() * 8 + 1 + + return { + className, + duration, + } + }) +} + +const animations = ref<{ className: string; duration: number }[]>(shuffle(createAnimationDurations()))