@morlz/motion
v0.1.9
Published
Vue directives for transition components between routes
Downloads
27
Readme
@morlz/motion
Demo
npm run demo
See gif:
Installing
npm i @morlz/motion
yarn add @morlz/motion
Usage
index.js file:
import Vue from 'vue'
import Motion from '@morlz/motion'
//options are optional
Vue.use(Motion, {
quasar: false,
duration: 375
})
Layout.vue
<layout>
<div>
<router-view name="list"/>
</div>
<router-view name="modal"/>
</layout>
List.vue
<list>
<item
v-for="item in items"
v-motion-from="'anynamespace'"/>
</list>
Modal.vue
<modal v-motion-to="'anynamespace'">
<item-full/>
</modal>
routes.js
{
path: '/any-path/',
component: () => import ('#/Layout'),
children: [
{
path: '',
components: {
list: () => import ('#/List')
},
},
{
path: ':id',
components: {
list: () => import ('#/List'),
modal: () => import ('#/Modal')
}
},
]
}
If you use Quasar-framework then use the noRouteDismiss attribute on QModal
API
Events
v-motion-to
Has emit the following events to context vm:
motion:show
when show animation startmotion:showed
when show animation endmotion:hide
when hide animation startmotion:hided
when hide animation endmotion:move(styles)
when animation is running
Modifers
v-motion-from.round
If the starting block is round
Styles
width
range 0 - 100 %height
range 0 - 100 %x
px position at the page by x axisy
px position at the page by y axisr
range 0 - 1 border radiusprogress
range 0 - 1 animation position
Injected $motion
Object styles vm.$motion
updates only in the component containing v-motion-to.
current
current stylesprogress
progress from stylesto
styles of fullscreen modal
MIT License
Copyright (c) 2018 morlz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.