Steps to see what I mean:
- Head to the vuetify website
- Click on the cog icon
- Select either dark or light theme.
As you alternate between different themes, an animation plays. A circle (starting from roughly the position of the button) expands, eventually engulfing the entire screen in the new theme.
I can’t find any instructions in the docs on how that can be replicated. For me, a transition plays where the colours fade into their new variants, but it looks quite tacky compared to what they have going on.
Is this a feature of vuetify? How can I replicate this behaviour?
2
Answers
Here is a simple example of how to achieve this:
Clicking the button will toggle the
darkTheme
boolean, which applies the dark or light theme to the entireVuetify
application. The transition animation remains the same, smoothly transitioning the theme change with the expanding circle effect. Adjust the transition duration and timing functions as needed.The one on vuetifyjs.com works by copying the entire DOM, setting the correct scroll positions on the copied elements, then applying a css clip-path transition to reveal the original DOM with the new theme applied.
https://github.com/vuetifyjs/vuetify/blob/60218ee82cabaf0d6c1f22d64a24c0e32b4e4247/packages/docs/src/App.vue#L96