Skip to content

Commit b2e13b0

Browse files
committed
Feat : FlipX + FlipY Added To Library and Website
1 parent e2046d2 commit b2e13b0

File tree

6 files changed

+111
-0
lines changed

6 files changed

+111
-0
lines changed

playground/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import RotateDown from '@/components/RotateDown.vue'
4545
import ZoomIn from '@/components/ZoomIn.vue'
4646
import ZoomUp from '@/components/ZoomUp.vue'
4747
import ZoomDown from '@/components/ZoomDown.vue'
48+
import FlipX from '@/components/FlipX.vue'
49+
import FlipY from '@/components/FlipY.vue'
4850
4951
const showSideBar = ref(true)
5052
const currentAnimation = shallowRef(Fade)
@@ -65,6 +67,8 @@ const animationMap = {
6567
ZoomIn,
6668
ZoomUp,
6769
ZoomDown,
70+
FlipX,
71+
FlipY,
6872
}
6973
7074
const setAnimation = (name) => {

playground/components/sideBar.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ const animations = ref([
4545
title: 'Bounces',
4646
children: ['BounceDown', 'BounceIn', 'BounceUp'],
4747
},
48+
49+
{
50+
title: 'Flips',
51+
children: ['FlipX', 'FlipY'],
52+
},
4853
{
4954
title: 'Fades',
5055
children: ['Fade'],

src/components/FlipX.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<Transition
3+
name="flipX"
4+
:appear="appear"
5+
:style="{
6+
'--animation-duration': duration + 'ms',
7+
'--animation-easing': easing,
8+
'--animation-delay': delay + 'ms',
9+
}"
10+
v-bind="$attrs"
11+
>
12+
<slot></slot>
13+
</Transition>
14+
</template>
15+
16+
<script setup>
17+
import { commonProps } from './commonProps.js'
18+
const props = defineProps({ ...commonProps })
19+
</script>

src/components/FlipY.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<Transition
3+
name="flipY"
4+
:appear="appear"
5+
:style="{
6+
'--animation-duration': duration + 'ms',
7+
'--animation-easing': easing,
8+
'--animation-delay': delay + 'ms',
9+
}"
10+
v-bind="$attrs"
11+
>
12+
<slot></slot>
13+
</Transition>
14+
</template>
15+
16+
<script setup>
17+
import { commonProps } from './commonProps.js'
18+
const props = defineProps({ ...commonProps })
19+
</script>

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import RotateUp from './components/RotateUp.vue'
1414
import ZoomDown from './components/ZoomDown.vue'
1515
import ZoomUp from './components/ZoomUp.vue'
1616
import ZoomIn from './components/ZoomIn.vue'
17+
import FlipX from './components/FlipX.vue'
18+
import FlipY from './components/FlipY.vue'
1719

1820
export {
1921
Fade,
@@ -30,4 +32,6 @@ export {
3032
ZoomDown,
3133
ZoomUp,
3234
ZoomIn,
35+
FlipX,
36+
FlipY,
3337
}

src/styles/animations.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,63 @@ GLOBAL VARIABLES (defaults)
425425
animation: ZoomDown var(--animation-duration, 0.5s) var(--animation-delay, 0s)
426426
var(--animation-easing, ease) reverse forwards;
427427
}
428+
429+
@keyframes FlipX {
430+
0% {
431+
opacity: 0;
432+
transform: perspective(100px) rotate3d(1, 0, 0, 90deg);
433+
}
434+
40% {
435+
transform: perspective(100px) rotate3d(1, 0, 0 20deg);
436+
}
437+
60% {
438+
transform: perspective(100px) rotate3d(1, 0, 0, -10deg);
439+
}
440+
to {
441+
transform: perspective(200px);
442+
}
443+
}
444+
445+
/* When entering */
446+
.flipX-enter-active {
447+
position: absolute;
448+
animation: FlipX var(--animation-duration, 0.5s) var(--animation-delay, 0s)
449+
var(--animation-easing, ease) forwards;
450+
}
451+
452+
/* When leaving */
453+
.flipX-leave-active {
454+
position: absolute;
455+
animation: FlipX var(--animation-duration, 0.5s) var(--animation-delay, 0s)
456+
var(--animation-easing, ease) reverse forwards;
457+
}
458+
459+
@keyframes FlipY {
460+
0% {
461+
opacity: 0;
462+
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
463+
}
464+
40% {
465+
transform: perspective(400px) rotate3d(0, 1, 0 20deg);
466+
}
467+
60% {
468+
transform: perspective(400px) rotate3d(0, 1, 0, -10deg);
469+
}
470+
to {
471+
transform: perspective(400px);
472+
}
473+
}
474+
475+
/* When entering */
476+
.flipY-enter-active {
477+
position: absolute;
478+
animation: FlipY var(--animation-duration, 0.5s) var(--animation-delay, 0s)
479+
var(--animation-easing, ease) forwards;
480+
}
481+
482+
/* When leaving */
483+
.flipY-leave-active {
484+
position: absolute;
485+
animation: FlipY var(--animation-duration, 0.5s) var(--animation-delay, 0s)
486+
var(--animation-easing, ease) reverse forwards;
487+
}

0 commit comments

Comments
 (0)