javascript - 这个动画过渡效果,可以用css3实现吗?想了很长时间,没什么思路啊
黄舟
黄舟 2017-04-11 12:57:59
[JavaScript讨论组]

最开始白色部分就是这样,然后鼠标放上去就变成下面这样,原网站是svg弄得,能不能用css动画做出来他的这个过渡效果,这是原网站
不用跟我说 用什么css过度和动画,我知道,css做出来这个初始样子我也会,我就是不知道这个过渡动画该如何实现,是否可以用css加js实现。求助

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(2)
阿神

大概这样?
我的这个动画没回弹,想要回弹自己搞一个吧。

<!DOCTYPE html>
<!--
        Author: SpringHack - springhack@live.cn
        Last modified: 2017-03-26 10:16:39
        Filename: index.html
        Description: Created by SpringHack using vim automatically.
-->
<html>
    <head>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
        <title>View</title>
        <style>
            * {
                padding: 0;
                margin: 0;
                border: 0;
                transition: all .25s;
            }
            body {
                display: flex;
                justify-content: center;
                align-items: center;
                position: absolute;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
            }
            .View {
                position: relative;
                overflow: hidden;
                width: 240px;
                height: 420px;
                background: url(http://page.tobee.me/home/img/1.png);
            }
            .View img {
                z-index: -1;
                position: absolute;
                top: 0;
            }
            .View .Title {
                background: rgba(0, 0, 0, .2);
                height: 420px;
            }
            .View .Title .TitleText {
                color: #52be7f;
                font-size: 24px;
                padding: 40px;
                text-align: center;
                background: #ffffff;
            }
            .View .Title .TitleText p {
                color: #aaa;
                font-size: 14px;
                padding-top: 10px;
                text-align: center;
            }
            .View .Title .TitleArea {
                border: 120px #ffffff solid;
                border-top: 0px #ffffff solid;
                border-bottom: 50px transparent solid;
                transition: all 0s;
            }
            .View .Title .MoreView {
                display: flex;
                justify-content: center;
                position: absolute;
                top: 50%;
                left: 0;
                right: 0;
            }
            .View .Title .MoreView button {
                color: #52be7f;
                border: 1px #52be7f solid;
                border-radius: 20px;
                padding: 5px 20px 5px 20px;
                width: 70px;
                background: transparent;
                transform: scale(0);
            }
            .View .Title:hover {
                background: rgba(0, 0, 0, 0);
            }
            .View .Title:hover .TitleArea {
                animation: .125s ease dealA forwards, .125s ease dealB forwards;
            }
            .View .Title:hover .MoreView button {
                transform: scale(1);
            }
            .View .Title:hover .TitleText {
                padding: 10px;
            }
            .View .Title:hover .TitleText p {
                color: transparent;
                height: 0;
            }
            @keyframes dealA {
                to {
                    border-bottom: 0 transparent solid;
                }
            }
            @keyframes dealB {
                from {
                    border-left: 120px transparent solid;
                    border-right: 120px transparent solid;
                }
                to {
                    border-left: 120px transparent solid;
                    border-right: 120px transparent solid;
                    border-top: 30px #ffffff solid;
                    border-bottom: 0 transparent solid;
                }
            }
        </style>
    </head>
    <body>
        <p class='View'>
            <p class='Title'>
                <p class='TitleText'>
                    就是这个
                    <p>什么鬼的</p>
                </p>
                <p class='TitleArea'></p>
                <p class='MoreView'>
                    <button class='More'>查看</button>
                </p>
            </p>
        </p>
    </body>
</html>
巴扎黑

用transform属性来做 应该是translate和rotate叠加

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号