css3实现开门效果

css3实现开门效果

 <div class="big">
        <div class="box men">
            <div class="door"></div>
            <div class="door-t"></div>
            <div class="door-r"></div>
            <div class="door-back"></div>
        </div>
        <div class="box mk">
            <div class="door"><span>open</span></div>
            <div class="door-t"></div>
            <div class="door-r"></div>
            <div class="door-back"></div>
        </div>
    </div>
 * {
            padding: 0;
            margin: 0;
        }
        
        body {
            background-color: rgb(19, 76, 109);
        }
        
        .big {
            perspective: 1200px;
            position: relative;
            width: 338px;
            height: 538px;
            margin: 100px auto;
        }
        
        .box {
            position: relative;
            top: 0;
            left: 0;
            width: 338px;
            height: 538px;
            transform-style: preserve-3d;
            transform-origin: left;
        }
        
        @keyframes move {
            0% {
                transform: rotateY(0deg);
            }
            50% {
                transform: rotateY(-120deg);
            }
            100% {
                transform: rotateY(0deg);
            }
        }
        
        .box:hover {
            animation-play-state: paused;
        }
        
        .door {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 300px;
            height: 500px;
            background-color: rgb(4, 55, 85);
            border: 2px solid #000;
            transform: translateZ(15px);
        }
        
        .door-back {
            position: absolute;
            left: 0;
            bottom: 0;
            width: 300px;
            height: 500px;
            background-color: rgb(4, 55, 85);
            border: 2px solid #000;
            transform: translateZ(-15px);
        }
        
        .door-t {
            position: absolute;
            top: 0;
            left: 0;
            width: 300px;
            height: 30px;
            background-color: rgb(4, 55, 85);
            border: 2px solid #000;
            transform: translateY(15px) rotateX(90deg);
        }
        
        .door-r {
            position: absolute;
            right: 0;
            bottom: 0;
            width: 30px;
            height: 500px;
            background-color: rgb(4, 55, 85);
            border: 2px solid #000;
            transform: translateX(-15px) rotateY(90deg);
        }
        
        .mk {
            position: absolute;
            top: 0;
            left: 0;
            animation: move 2s linear infinite;
        }
        
        .men .door {
            background-color: #fff;
        }
        
        span {
            position: absolute;
            left: 50%;
            top: 50%;
            display: inline-block;
            width: 60px;
            height: 40px;
            border-radius: 10px;
            line-height: 40px;
            font-size: 20px;
            font-weight: 700;
            background-color: rgb(218, 157, 27);
            border: 2px solid #000;
            text-align: center;
        }
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值