酷炫纯CSS代码实现时空穿梭动效

效果展示:

使用场景,可以用于大数据大屏背景,或者是穿越动画的过渡,下载地址在文章末尾

项目目录结构:

 

html部分:

 <!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>酷炫纯CSS代码实现时空穿梭动效</title>
        <link rel="stylesheet" href="css/index.css">
    </head>
    <body>
        <div class="scene">
            <div class="wrap">
                <div class="wall wall-right"></div>
                <div class="wall wall-left"></div>
                <div class="wall wall-top"></div>
                <div class="wall wall-bottom"></div>
                <div class="wall wall-back"></div>
            </div>
            <div class="wrap">
                <div class="wall wall-right"></div>
                <div class="wall wall-left"></div>
                <div class="wall wall-top"></div>
                <div class="wall wall-bottom"></div>
                <div class="wall wall-back"></div>
            </div>
        </div>
    </body>
</html>

css部分:

.wall {
    background: url(../img/123.jpg);
    background-size: cover;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background: #000;
    text-align: center;
}

body:before {
    content: '';
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

.scene {
    display: inline-block;
    vertical-align: middle;
    perspective: 5px;
    perspective-origin: 50% 50%;
    position: relative;
}

.wrap {
    position: absolute;
    width: 1000px;
    height: 1000px;
    left: -500px;
    top: -500px;
    transform-style: preserve-3d;
    animation: move 12s infinite linear;
    animation-fill-mode: forwards;
}

.wrap:nth-child(2) {
    animation: move 12s infinite linear;
    animation-delay: 6s;
}

.wall {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    animation: fade 12s infinite linear;
    animation-delay: 0;
}

.wrap:nth-child(2) .wall {
    animation-delay: 6s;
}

.wall-right {
    transform: rotateY(90deg) translateZ(500px);
}

.wall-left {
    transform: rotateY(-90deg) translateZ(500px);
}

.wall-top {
    transform: rotateX(90deg) translateZ(500px);
}

.wall-bottom {
    transform: rotateX(-90deg) translateZ(500px);
}

.wall-back {
    transform: rotateX(180deg) translateZ(500px);
}

@keyframes move {
    0% {
        transform: translateZ(-500px) rotate(0deg);
    }

    100% {
        transform: translateZ(500px) rotate(0deg);
    }
}

@keyframes fade {
    0% {
        opacity: 0;
    }

    25% {
        opacity: 1;
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
 

源码下载地址:https://download.csdn.net/download/qq_27939089/86260431

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

web前端*先森

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值