UNPKG

1.2 kBPlain TextView Raw
1<template>
2 <component :is="componentType"
3 :tag="tag"
4 v-bind="$attrs"
5 v-on="hooks"
6 enter-active-class="scaleIn"
7 move-class="scale-move"
8 leave-active-class="scaleOut">
9 <slot></slot>
10 </component>
11</template>
12<script>
13 import {baseTransition} from '../mixins/index.js'
14
15 export default {
16 name: 'scale-transition',
17 mixins: [baseTransition],
18 props: {
19 origin: {
20 type: String,
21 default: 'top left'
22 },
23 styles: {
24 type: Object,
25 default: () => {
26 return {
27 animationFillMode: 'both',
28 animationTimingFunction: 'cubic-bezier(.25,.8,.50,1)'
29 }
30 }
31 }
32 }
33 }
34</script>
35<style>
36 @keyframes scaleIn {
37 from {
38 opacity: 0;
39 transform: scale(0)
40 }
41
42 to {
43 opacity: 1;
44 }
45 }
46
47 .scaleIn {
48 animation-name: scaleIn;
49 }
50
51 @keyframes scaleOut {
52 from {
53 opacity: 1;
54 }
55
56 to {
57 opacity: 0;
58 transform: scale(0);
59 }
60 }
61
62 .scaleOut {
63 animation-name: scaleOut;
64 }
65
66 .scale-move {
67 transition: transform .3s cubic-bezier(.25, .8, .50, 1);
68 }
69</style>