Home> Web Front-end> Vue.js> body text

Teach you how to use Vue to achieve animation effects (with code)

奋力向前
Release: 2021-08-19 09:47:49
forward
3022 people have browsed it

In the previous article "Teach you step by step how to use CSS3 to create a simple page layout (detailed code explanation)", I introduced you how to use CSS3 to create a simple page layout. The following article will introduce to you how to use Vue to achieve animation effects. Friends in need can refer to it. I hope it will be helpful to you.

Teach you how to use Vue to achieve animation effects (with code)

Official API address: https://cn.vuejs.org/v2/guide/transitions.html

OfficialdemoClick to show and disappear

hello

Copy after login

transitionUse

 (元素,属性、路由....) 
Copy after login

classDefinition

.fade-enter{ }Enter the start state of the transition, which takes effect when the element is inserted, and is deleted immediately after applying only one frame; (initial state of motion)

.fade-enter-active{ }Enter the end state of the transition, which takes effect when the element is inserted, and is removed after transition/animationis completed. This class can be used to define transition process times, delays and curve functions.

.fade-leave{ }Leaves the start state of the transition, triggered when the element is deleted, and is deleted immediately after applying only one frame;

.fade- leave-active{ }Leaves the end state of the transition, takes effect when the element is deleted, and is removed aftertransition/animationis completed. This class can be used to define transition process times, delays and curve functions.

Customized transition class name

  • The default.fade-enterbecomes.fade-in-enter

  • The default.fade-enter-activebecomes.fade-in-active

  • Default.fade-leavebecomes.fade-out-enter

  • Default.fade-leave-activebecomes.fade-out-active

 

hello

Copy after login
.fade-in-active, .fade-out-active { transition: all 0.5s ease; } .fade-in-enter, .fade-out-active { opacity: 0; }
Copy after login

transitionRelated functions

 
Copy after login

transitionCombined withanimate.cssUse

The following code demonstrates the animation of elements flipping in and out with the X-axis as the baselineAnimate.cssLibrary point Here is the address: https://animate.style/

  
Copy after login

List transition

 
Copy after login

It should be noted that when grouping, the value of the key directly affects the animation. Transition, for details, please refer tovue animation key value affects transition animation performance

Recommended learning:JavaScript video tutorial

The above is the detailed content of Teach you how to use Vue to achieve animation effects (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:chuchur.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author