File tree Expand file tree Collapse file tree 9 files changed +199
-15
lines changed Expand file tree Collapse file tree 9 files changed +199
-15
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vue-transify" ,
3- "version" : " 1.1.1 " ,
3+ "version" : " 1.2.0 " ,
44 "private" : false ,
55 "type" : " module" ,
66 "main" : " dist/vue-transify.umd.js" ,
3838 "license" : " MIT" ,
3939 "description" : " Animation library built on top of vue.js Transitiion component for fast and easy to use animations" ,
4040 "peerDependencies" : {
41- "vue" : " ^3.5.22"
41+ "vue" : " ^3.5.22" ,
42+ "vue-router" : " ^4.5.1"
43+ },
44+ "peerDependenciesMeta" : {
45+ "vue-router" : {
46+ "optional" : true
47+ }
4248 },
4349 "devDependencies" : {
4450 "@vitejs/plugin-vue" : " ^6.0.1" ,
4551 "prettier" : " 3.6.2" ,
4652 "vite" : " ^7.1.7" ,
47- "vite-plugin-vue-devtools" : " ^8.0.2"
53+ "vite-plugin-vue-devtools" : " ^8.0.2" ,
54+ "vue-router" : " ^4.5.1"
4855 }
4956}
Original file line number Diff line number Diff line change 1010 See Motions
1111 </button >
1212 </div >
13-
1413 <small class =" main-container--version"
15- >V-1.1.1 | Developed by <a href =" https://github.com/Redskullvue" >RedskullVue</a >
14+ >V-1.2.0 | Developed by
15+ <a href =" https://github.com/Redskullvue" >RedskullVue </a >
16+ | Scroll Down To see page transitions
1617 </small >
1718 </main >
1819
2627 </SlideInRight >
2728 </aside >
2829 </div >
30+ <!-- Where Router-View Is Rendering -->
31+ <div class =" router-view-container" >
32+ <PageTransitionHelper mode =" out-in" :duration =" 1000" />
33+ </div >
2934</template >
3035
3136<script setup>
@@ -47,6 +52,7 @@ import ZoomUp from '@/components/ZoomUp.vue'
4752import ZoomDown from ' @/components/ZoomDown.vue'
4853import FlipX from ' @/components/FlipX.vue'
4954import FlipY from ' @/components/FlipY.vue'
55+ import PageTransitionHelper from ' @/components/PageTransitionHelper.vue'
5056
5157const showSideBar = ref (true )
5258const currentAnimation = shallowRef (Fade)
@@ -83,6 +89,14 @@ const setAnimation = (name) => {
8389 </script >
8490
8591<style >
92+ .router-view-container {
93+ width : 100% ;
94+ height : 70vh ;
95+ display : flex ;
96+ justify-content : center ;
97+ align-items : center ;
98+ overflow : hidden ;
99+ }
86100* {
87101 padding : 0px ;
88102 margin : 0px ;
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" container" >
3+ <h1 >Page 1</h1 >
4+ <h4 >{{ route.meta.transition }}</h4 >
5+ <router-link class =" button" to =" /test" >Change Page</router-link >
6+ </div >
7+ </template >
8+ <script setup>
9+ import { useRoute } from ' vue-router'
10+ const route = useRoute ()
11+ </script >
12+ <style scoped>
13+ .container {
14+ width : 100% ;
15+ height : 100% ;
16+ background-color : lightgreen ;
17+ display : flex ;
18+ flex-direction : column ;
19+ }
20+ .button {
21+ padding : 10px 30px ;
22+ margin-top : 10px ;
23+ border-radius : 10px ;
24+ background-color : green ;
25+ color : white ;
26+ text-decoration : none ;
27+ }
28+ </style >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" container" >
3+ <h1 >Page 2</h1 >
4+ <h4 >{{ route.meta.transition }}</h4 >
5+ <router-link to =" /" class =" button" >Change Page</router-link >
6+ </div >
7+ </template >
8+
9+ <script setup>
10+ import { useRoute } from ' vue-router'
11+ const route = useRoute ()
12+ </script >
13+
14+ <style scoped>
15+ .container {
16+ width : 100% ;
17+ height : 100% ;
18+ background-color : lightblue ;
19+ display : flex ;
20+ flex-direction : column ;
21+ }
22+ .button {
23+ padding : 10px 30px ;
24+ margin-top : 10px ;
25+ border-radius : 10px ;
26+ background-color : green ;
27+ color : white ;
28+ text-decoration : none ;
29+ }
30+ </style >
Original file line number Diff line number Diff line change 11import { createApp } from 'vue'
22import App from './App.vue'
33import '@/styles/animations.css'
4+ import { router } from './routes'
45
5- createApp ( App ) . mount ( '#app' )
6+ const app = createApp ( App )
7+
8+ app . use ( router )
9+
10+ app . mount ( '#app' )
Original file line number Diff line number Diff line change 1+ import { createRouter , createWebHistory } from 'vue-router'
2+ import HomeView from '../Views/HomeView.vue'
3+ import TestView from '../Views/TestView.vue'
4+
5+ export const router = createRouter ( {
6+ history : createWebHistory ( ) ,
7+ routes : [
8+ {
9+ path : '/' ,
10+ name : 'Home' ,
11+ component : HomeView ,
12+ } ,
13+ {
14+ path : '/test' ,
15+ name : 'TestView' ,
16+ component : TestView ,
17+ } ,
18+ ] ,
19+ } )
20+
21+ const availableAnimations = [
22+ 'fade' ,
23+ 'slideInLeft' ,
24+ 'slideInRight' ,
25+ 'slideInUp' ,
26+ 'slideInDown' ,
27+ 'bounceIn' ,
28+ 'bounceDown' ,
29+ 'bounceUp' ,
30+ 'rotateIn' ,
31+ 'rotateUp' ,
32+ 'rotateDown' ,
33+ 'zoomIn' ,
34+ 'zoomUp' ,
35+ 'zoomDown' ,
36+ 'flipX' ,
37+ 'flipY' ,
38+ ]
39+ //Select a random animation from animation list to have random transitions
40+ router . beforeEach ( ( to , from , next ) => {
41+ const randomAnimation =
42+ availableAnimations [ Math . floor ( Math . random ( ) * availableAnimations . length ) ]
43+
44+ to . meta . transition = randomAnimation
45+
46+ next ( )
47+ } )
Original file line number Diff line number Diff line change 1+ <template >
2+ <RouterView v-slot =" { Component, route }" v-bind =" $attrs" >
3+ <Transition
4+ :name =" route.meta.transition || 'fade'"
5+ :mode =" mode"
6+ :style =" {
7+ '--animation-duration': duration + 'ms',
8+ }"
9+ >
10+ <component :is =" Component" :key =" route.path" />
11+ </Transition >
12+ </RouterView >
13+ </template >
14+ <script setup>
15+ const props = defineProps ({
16+ mode: { type: String , default: ' out-in' },
17+ duration: { type: Number , default: 500 },
18+ })
19+ </script >
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import ZoomUp from './components/ZoomUp.vue'
1616import ZoomIn from './components/ZoomIn.vue'
1717import FlipX from './components/FlipX.vue'
1818import FlipY from './components/FlipY.vue'
19+ import PageTransitionHelper from './components/PageTransitionHelper.vue'
1920
2021export {
2122 Fade ,
@@ -34,4 +35,5 @@ export {
3435 ZoomIn ,
3536 FlipX ,
3637 FlipY ,
38+ PageTransitionHelper ,
3739}
You can’t perform that action at this time.
0 commit comments