CSS3 由小变大的过渡动画

一个DIV,由小变大,然后加透视

怎么实现啊。

单纯的使用scale好像不怎么明显啊。如果加上透视,效果更逼真啊。

阅读 30.8k
6 个回答

用动画啊,`<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>动画</title>
    <style>
        .div{
            width: 100px;
            height: 100px;
            position: absolute;
            background: #C94E00;
            opacity: 1;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            animation: change 5s;
            -moz-animation: change 5s;    
            -webkit-animation: change 5s;    
            -o-animation: change 5s;
        }
        @keyframes change{
            from {width: 100px;height: 100px;opacity: 1;}
            to {width: 500px;height: 500px;opacity: 0;}
        }
    </style>
</head>
<body>
    <div class="div"></div>
</body>

</html>`

你指的是这样?

    div{
        width:100px;
        height:100px;
        background:red;
        transition:1s ease;
    }
    div:hover{
        transform:scale(2);
        opacity:0;
    }
新手上路,请多包涵

css3 animation 可以实现

楼上那么多人回答了,我就不贴代码了,我给你个东西,可以左边看效果了,复制代码就好了,原理很好懂,我现在一般都用腾讯的这个写效果。
呐网址:http://isux.tencent.com/css3/...

图片描述

谢邀,我来晚了。transition也可以。
transition适合两个关键帧之间过渡
animation适合有多个关键帧

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题