I'm looking for a solution to make animation between routes in gridsome. I would like to create full width and height overlay animating from left to right. When the overlay is on full width then it should replace the content in the slot.
What I was trying to do is
<div class="overlay" :class="{ 'overlay--open': overlayOpen }"></div>
<transition
appear
v-on:before-appear="beforeAppear"
v-on:appear="appear"
v-on:after-appear="afterAppear"
>
<main>
<slot/>
</main>
</transition>
and in methods
methods: {
beforeAppear: function (el) {
this.overlayOpen = true
}
}
style
.overlay{
position: fixed;
width: 100%;
height: 100vh;
top: 0;
left: 0;
background-color: #0c0c0c;
z-index: 99999;
transition: all 500ms;
transform-origin: left;
transform: scaleX(0);
&--open{
animation: open 1s;
}
@keyframes open {
0% {
transform: scaleX(0);
}
50% {
transform: scaleX(1);
}
100% {
transform: scaleX(0);
}
It almost worked but I don't think that is good practice for route transition. If you have any idea how to make it I would really appreciate it. Thanks