Created
January 22, 2020 03:22
-
-
Save christopher4lis/94e6474ebe8319a39d31b76060447a9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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