Skip to content

Instantly share code, notes, and snippets.

@christopher4lis
Created January 22, 2020 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save christopher4lis/94e6474ebe8319a39d31b76060447a9b to your computer and use it in GitHub Desktop.
Save christopher4lis/94e6474ebe8319a39d31b76060447a9b to your computer and use it in GitHub Desktop.
<template>
<Transition
:css="false"
name="scale-in"
mode="out-in"
@before-enter="beforeEnter"
@enter="enter"
@leave="leave"
>
<slot />
</Transition>
</template>
<script>
import gsap from 'gsap'
export default {
name: 'ScaleIn',
methods: {
beforeEnter(el) {
gsap.set(el, { opacity: 1, scale: 0 })
},
enter(el, done) {
gsap.to(el, {
duration: 0.5,
scale: 1,
ease: 'expo',
onComplete: done
})
},
leave(el, done) {
gsap.to(el, {
duration: 0.3,
opacity: 0,
ease: 'expo',
onComplete: done
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment