css3徽章特效

css3 徽章特效

实现

使用N张图片,使其在Z轴偏移堆叠,形成厚度,使用3D转换,就是徽章的效果了

代码

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      html,body{
          width: 100%;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
      }
      @keyframes spin {
          0% {
              transform: rotateY(0deg);
          }
          100% {
              transform: rotateY(360deg);
          }
      }
      .badge {
          width: 23vw;
          height: 23vw;
          min-width: 400px;
          min-height: 400px;
          transform-style: preserve-3d;
          animation: spin 5.5s linear infinite;
      }

      .badge > div:nth-child(1) {
          transform: translateZ(0.5px);
      }

      .badge > div:nth-child(2) {
          transform: translateZ(1px);
      }

      .badge > div:nth-child(3) {
          transform: translateZ(1.5px);
      }

      .badge > div:nth-child(4) {
          transform: translateZ(2px);
      }

      .badge > div:nth-child(5) {
          transform: translateZ(2.5px);
      }

      .badge > div:nth-child(6) {
          transform: translateZ(3px);
      }

      .badge > div:nth-child(7) {
          transform: translateZ(3.5px);
      }

      .badge > div:nth-child(8) {
          transform: translateZ(4px);
      }

      .badge > div:nth-child(9) {
          transform: translateZ(4.5px);
      }

      .badge > div:nth-child(10) {
          transform: translateZ(5px);
      }

      .badge > div:nth-child(11) {
          transform: translateZ(5.5px);
      }

      .badge > div:nth-child(12) {
          transform: translateZ(6px);
      }

      .badge > div:nth-child(13) {
          transform: translateZ(6.5px);
      }

      .badge > div:nth-child(14) {
          transform: translateZ(7px);
      }

      .badge > div:nth-child(15) {
          transform: translateZ(7.5px);
      }

      .badge > div:nth-child(16) {
          transform: translateZ(8px);
      }

      .badge > div:nth-child(17) {
          transform: translateZ(8.5px);
      }

      .badge > div:nth-child(18) {
          transform: translateZ(9px);
      }

      .badge > div:nth-child(19) {
          transform: translateZ(9.5px);
      }

      .badge > div:nth-child(20) {
          transform: translateZ(10px);
      }

      .badge > div {
          background-image: url("https://web03-1252477692.cos.ap-guangzhou.myqcloud.com/blog/images/1e84e715773a4652a0207d7e501341a1.png");
          height: 100%;
          width: 100%;
          transform: translateZ(1px);
          position: absolute;
          top: 0;
          background-size: 100% 100%;
      }
  </style>
</head>
<body>
<div class="badge">
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>
</body>
</html>

demo

https://web03-1252477692.cos.ap-guangzhou.myqcloud.com/blog/files/5ef87833b94c41f6a3c1bf73976608c1.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值