diff --git a/README.md b/README.md index 3fdb662..da35ab6 100644 --- a/README.md +++ b/README.md @@ -70,25 +70,6 @@ const show = ref(true) --- -## Animations on 0.9.1 - --Fade --BounceDown --BounceIn --BounceUp --RotateDown --RotateIn --RotateUp --SlideInDown --SlideInUp --SlideInLeft --SlideInRight --ZoomDown --ZoomIn --ZoomUp - ---- - ## ⚙️ Props -Library is fully prop based so you can customize the animations based on your need diff --git a/playground/App.vue b/playground/App.vue index 4bb92ca..2a84b0c 100644 --- a/playground/App.vue +++ b/playground/App.vue @@ -45,6 +45,8 @@ import RotateDown from '@/components/RotateDown.vue' import ZoomIn from '@/components/ZoomIn.vue' import ZoomUp from '@/components/ZoomUp.vue' import ZoomDown from '@/components/ZoomDown.vue' +import FlipX from '@/components/FlipX.vue' +import FlipY from '@/components/FlipY.vue' const showSideBar = ref(true) const currentAnimation = shallowRef(Fade) @@ -65,6 +67,8 @@ const animationMap = { ZoomIn, ZoomUp, ZoomDown, + FlipX, + FlipY, } const setAnimation = (name) => { diff --git a/playground/components/sideBar.vue b/playground/components/sideBar.vue index 51ee3fc..f47b021 100644 --- a/playground/components/sideBar.vue +++ b/playground/components/sideBar.vue @@ -45,6 +45,11 @@ const animations = ref([ title: 'Bounces', children: ['BounceDown', 'BounceIn', 'BounceUp'], }, + + { + title: 'Flips', + children: ['FlipX', 'FlipY'], + }, { title: 'Fades', children: ['Fade'], diff --git a/src/components/FlipX.vue b/src/components/FlipX.vue new file mode 100644 index 0000000..522f90e --- /dev/null +++ b/src/components/FlipX.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/components/FlipY.vue b/src/components/FlipY.vue new file mode 100644 index 0000000..6aeb100 --- /dev/null +++ b/src/components/FlipY.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/index.js b/src/index.js index deef19f..2c86bec 100644 --- a/src/index.js +++ b/src/index.js @@ -14,6 +14,8 @@ import RotateUp from './components/RotateUp.vue' import ZoomDown from './components/ZoomDown.vue' import ZoomUp from './components/ZoomUp.vue' import ZoomIn from './components/ZoomIn.vue' +import FlipX from './components/FlipX.vue' +import FlipY from './components/FlipY.vue' export { Fade, @@ -30,4 +32,6 @@ export { ZoomDown, ZoomUp, ZoomIn, + FlipX, + FlipY, } diff --git a/src/styles/animations.css b/src/styles/animations.css index 28c8b4a..5c2a0e2 100644 --- a/src/styles/animations.css +++ b/src/styles/animations.css @@ -425,3 +425,63 @@ GLOBAL VARIABLES (defaults) animation: ZoomDown var(--animation-duration, 0.5s) var(--animation-delay, 0s) var(--animation-easing, ease) reverse forwards; } + +@keyframes FlipX { + 0% { + opacity: 0; + transform: perspective(100px) rotate3d(1, 0, 0, 90deg); + } + 40% { + transform: perspective(100px) rotate3d(1, 0, 0 20deg); + } + 60% { + transform: perspective(100px) rotate3d(1, 0, 0, -10deg); + } + to { + transform: perspective(200px); + } +} + +/* When entering */ +.flipX-enter-active { + position: absolute; + animation: FlipX var(--animation-duration, 0.5s) var(--animation-delay, 0s) + var(--animation-easing, ease) forwards; +} + +/* When leaving */ +.flipX-leave-active { + position: absolute; + animation: FlipX var(--animation-duration, 0.5s) var(--animation-delay, 0s) + var(--animation-easing, ease) reverse forwards; +} + +@keyframes FlipY { + 0% { + opacity: 0; + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + } + 40% { + transform: perspective(400px) rotate3d(0, 1, 0 20deg); + } + 60% { + transform: perspective(400px) rotate3d(0, 1, 0, -10deg); + } + to { + transform: perspective(400px); + } +} + +/* When entering */ +.flipY-enter-active { + position: absolute; + animation: FlipY var(--animation-duration, 0.5s) var(--animation-delay, 0s) + var(--animation-easing, ease) forwards; +} + +/* When leaving */ +.flipY-leave-active { + position: absolute; + animation: FlipY var(--animation-duration, 0.5s) var(--animation-delay, 0s) + var(--animation-easing, ease) reverse forwards; +}