In-depth understanding of Vue transition and animation

In-depth understanding of Vue transition and animation

1. When inserting, updating, or removing DOM elements, add style class names to the elements when appropriate

2. The element has an entry process: Enter and a leaving process: Leave.

Both processes have an initial state () and a terminal state (-to) and a transition effect (activate) between the two states.

3. Writing

Animation : Write v-enter-active(替換come這個名字)和v-leave-active(替換go)(這兩個是vue的工作) and動畫atguigu(這個是css3的效果) . Just wrap the animation elements with <transition>. appear is to execute v-enter-activate once the element is loaded

Transition : The starting point and end point here are the role of Vue.

or

<style scoped>
/* .todo-enter-active{
    animation: myAnamite 1s;
}
.todo-leave-active{
    animation: myAnamite 1s reverse;
}
@keyframes myAnamite {
    from{
        transform: translateX(-100%);
    }
    to{
        transform: translateX(0);
    }
} */
.todo-enter,.todo-leave-to{
    transform: translateX(-100%);
}
.todo-leave,.todo-enter-to{
    transform: translateX(0);
}
.todo-enter-active, .todo-leave-active {
    transition: 1s linear;
}
</style>

Multiple elements overload:

Third-party animation library: anamite.css庫

Install:

Import: import 'animate.css' in script

Summarize

This article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of Vue transition effects and animation transition usage examples
  • Detailed explanation of the application of transition animation effects in Vue
  • Vue learning notes advanced chapter single element transition
  • Vue handwriting loading animation project
  • Vue implements carousel animation

<<:  Using CSS3 to achieve transition and animation effects

>>:  LinkedIn revamps to simplify website browsing

Recommend

About the correct way to convert time in js when importing excel

Table of contents 1. Basics 2. Problem Descriptio...

js to achieve floor scrolling effect

This article uses jQuery to implement the sliding...

Detailed installation tutorial of mysql 5.7 under CentOS 6 and 7

You always need data for development. As a server...

Examples of MySQL and Python interaction

Table of contents 1. Prepare data Create a data t...

Docker+nacos+seata1.3.0 installation and usage configuration tutorial

I spent a day on it before this. Although Seata i...

Implementation steps of encapsulating components based on React

Table of contents Preface How does antd encapsula...

MySQL multi-instance configuration application scenario

Table of contents MySQL multiple instances Multi-...

React event mechanism source code analysis

Table of contents Principle Source code analysis ...

Nginx Linux installation and deployment detailed tutorial

1. Introduction to Nginx Nginx is a web server th...

Vue3 Vue Event Handling Guide

Table of contents 1. Basic event handling 2. Send...

12 Laws of Web Design for Clean Code [Graphic]

Beautiful code is the foundation of a beautiful we...

PHP-HTMLhtml important knowledge points notes (must read)

1. Use frameset, frame and iframe to realize mult...

How to achieve centered layout in CSS layout

1. Set the parent container to a table and the ch...

Solutions to VMware workstation virtual machine compatibility issues

How to solve VMware workstation virtual machine c...