zoukankan      html  css  js  c++  java
  • CSS过渡、CSS动画

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8"/>
            <script src="vue.js"></script>
        </head>
        <body>
            <div>
            <h1>--CSS过渡--</h1>
            <div id="example1">
                <button @click="show = !show">Toggle render</button>
                <transition name="slide-fade">
                    <p v-if="show">hello</p>
                </transition>
            </div>
            <script>
            // Vue 根实例
            var example1 = new Vue({
                el: '#example1',
                data: {
                    show: true
                }
            })
            </script>
            <style>
                .slide-fade-enter-active {
                    transition: all .3s ease;
                }
                .slide-fade-leave-active {
                    transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
                }
                .slide-fade-enter, .slide-fade-leave-to {
                    transform: translateX(10px);
                    opacity: 0;
                }
            </style>
            </div>
            <div>
            <h1>--CSS动画--</h1>
            <div id="example2">
                <button @click="show = !show">Toggle show</button>
                <transition name="bounce">
                    <p v-if="show">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris facilisis enim libero, at lacinia diam fermentum id. Pellentesque habitant morbi tristique senectus et netus.</p>
                </transition>
            </div>
            <script>
            // Vue 根实例
            var example2 = new Vue({
                el: '#example2',
                data: {
                    show: true
                }
            })
            </script>
            <style>
                .bounce-enter-active {
                    animation: bounce-in .5s;
                }
                .bounce-leave-active {
                    animation: bounce-in .5s reverse;
                }
                @keyframes bounce-in {
                    0% {
                        transform: scale(0);
                    }
                    50% {
                        transform:scale(1.5);
                    }
                    100% {
                        transform:scale(1);
                    }
                }
            </style>
            </div>            
        </body>
    </html>

    运行效果图:

  • 相关阅读:
    VirtualBox COM对象获取失败
    layui的表单功能
    phpstudy+phpstorm配置xdebug
    wamp2.5怎么设置虚拟域名
    腾讯微博-转播到微博的简单使用
    新浪微博--分享到微博的简单使用
    CKEdiotr使用入门
    GridView删除行
    Python迭代器笔记
    Java基础之打印万年历
  • 原文地址:https://www.cnblogs.com/gongshunfeng91/p/11319807.html
Copyright © 2011-2022 走看看