Vue’s transition system offers many simple ways to animate entering, leaving, and lists, but what about animating your data itself? For example:
numbers and calculations
colors displayed
the positions of SVG nodes
the sizes and other properties of elements
All of these are either already stored as raw numbers or can be converted into numbers. Once we do that, we can animate these state changes using 3rd-party libraries to tween state, in combination with Vue’s reactivity and component systems.
1、Animating State with Watchers
Watchers allow us to animate changes of any numerical property into another property. That may sound complicated in the abstract, so let’s dive into an example using GreenSock:
https://vuejs.org/v2/guide/transitioning-state.html
Vue’s transition system offers many simple ways to animate entering, leaving, and lists, but what about animating your data itself? For example:
All of these are either already stored as raw numbers or can be converted into numbers. Once we do that, we can animate these state changes using 3rd-party libraries to tween state, in combination with Vue’s reactivity and component systems.
1、Animating State with Watchers
Watchers allow us to animate changes of any numerical property into another property. That may sound complicated in the abstract, so let’s dive into an example using GreenSock: