zoukankan      html  css  js  c++  java
  • @keyframes动画和animate.css

     <style>
          @keyframes bounce-in {
            0%{
              transform: scale(0);
            }
            50%{
              transform: scale(1.5);
            }
            100%{
              transform: scale(1);
            }
          }
          .fade-enter-active{
            transform-origin: left center;
           animation: bounce-in 1s;
          }
          .fade-leave-active{
            transform-origin: left center;
            animation: bounce-in 1s reverse;
          }
      </style>
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade'>
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>

    自定义类名:

    <style>
          @keyframes bounce-in {
            0%{
              transform: scale(0);
            }
            50%{
              transform: scale(1.5);
            }
            100%{
              transform: scale(1);
            }
          }
          .active{
            transform-origin: left center;
           animation: bounce-in 1s;
          }
          .leave{
            transform-origin: left center;
            animation: bounce-in 1s reverse;
          }
      </style>
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade' 
          enter-active-class='active'
          leave-active-class='leave'
        >
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>

    animate.css使用:

      <script src="./node_modules/vue/dist/vue.js"></script>
      <link rel='stylesheet' type="text/css" href="./animate.css">
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade' 
          enter-active-class='animated tada'
          leave-active-class='animated rubberBand'
        >
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>
  • 相关阅读:
    【Android API】Android 4.1 API官方文档详解
    【Android开发】Android Host详解(翻译自官方文档)
    Android调试桥-Android Debug Birdge详解
    冰淇淋三明治 (Android 4.0)介绍
    Android 4.1的新特性介绍
    【Android UI】如何做一个纯粹的Android app UI 设计
    【Android UI】Android颜色系大全
    【Android开发】交互界面布局详解
    阿里卖电影票 架构思路
    操作系统 虚拟内存 、分段、分页的理解
  • 原文地址:https://www.cnblogs.com/em2464/p/12333032.html
Copyright © 2011-2022 走看看