css数字翻牌动画效果

作者: Lia代码猪崽 | 来源:发表于2019-07-09 14:47 被阅读7次
效果如图
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .item {
            margin: 0 10px;
            padding: 0;
            float: left;
            position: relative;
            display: inline-block;
            width: 88px;
            height: 142px;
            color: #fff5e4;
            font-size: 92px;
            font-weight: bold;
            text-align: center;
            background-color: #500000;
            border-radius: 5px;
            overflow: hidden;
        }
        .content {
            position: absolute;
            left: 5px;
            top: 5px;
            width: calc(100% - 10px);
            height: calc(100% - 10px);
        }
        .bg {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            line-height: 144px;
            /*color: #000;*/
            /*z-index: 9;*/
            /*background-color: #ff1d5e;*/
        }
        .under {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        .under .top {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 70px;
            line-height: 142px;
            overflow: hidden;
            background-color: #db0000;
        }
        .under .bottom {
            position: absolute;
            left: 0;
            top: 72px;
            width: 100%;
            height: 70px;
            line-height: 0;
            overflow: hidden;
            background-color: #db0000;
        }
        .test {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        .test .top {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 70px;
            line-height: 0;
            overflow: hidden;
            background-color: #000;
            transform-origin: center bottom;
        }
        .test .bottom {
            position: absolute;
            left: 0;
            top: 72px;
            width: 100%;
            height: 60px;
            overflow: hidden;
            transform-origin: center top;
        }
        .test .test1 {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            line-height: 0;
            z-index: 99;
            background-color: #db0000;
        }
        @keyframes revolveScale {
            from {
                transform: rotateX(180deg);
                width: 100%;
            }
            to {
                transform: rotateX(0);
            }
        }
        .go {
            animation: revolveScale 1s;
            animation-direction: normal;
            animation-fill-mode: forwards;
        }
    </style>
</head>
<body>
<div class="item">
    <div class="content">
        <div class="bg"></div>
        <div class="under">
            <div class="top">2</div>
            <div class="bottom">2</div>
        </div>
        <div class="test">
            <div class="bottom go">
                <div class="test1">2</div>
            </div>
        </div>
    </div>
</div>
<div class="item">
    <div class="content">
        <div class="bg"></div>
        <div class="under">
            <div class="top">0</div>
            <div class="bottom">0</div>
        </div>
        <div class="test">
            <div class="bottom go">
                <div class="test1">0</div>
            </div>
        </div>
    </div>
</div>
<div class="item">
    <div class="content">
        <div class="bg"></div>
        <div class="under">
            <div class="top">1</div>
            <div class="bottom">1</div>
        </div>
        <div class="test">
            <div class="bottom go">
                <div class="test1">1</div>
            </div>
        </div>
    </div>
</div>
<div class="item">
    <div class="content">
        <div class="bg"></div>
        <div class="under">
            <div class="top">9</div>
            <div class="bottom">9</div>
        </div>
        <div class="test">
            <div class="bottom go">
                <div class="test1">9</div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

相关文章

网友评论

    本文标题:css数字翻牌动画效果

    本文链接:https://www.haomeiwen.com/subject/dlpxkctx.html