标签:origin scale show transform bounce keyframes active 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>
标签:origin,scale,show,transform,bounce,keyframes,active,animate,css 来源: https://www.cnblogs.com/em2464/p/12333032.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。