千鹤喵绫 我们不能死在最后一道墙里!真的要牺牲——就要死在这里!——《进击的巨人》
歌曲封面 未知作品

网站已运行 197 天 6 小时 4 分

Powered by Typecho & Sunny

2 online · 65 ms

Title

【分享】CSS 动画特效代码

😊

·

千鹤喵绫

·

Article

由5个圆形元素组成的3D旋转加载动画。每个圆形元素都在自己的轴上不断缩放,创建出旋转的视觉效果

代码分享:

♾️ html 代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
  .loading-container {
    perspective: 500px;
    width: 100px;
    height: 100px;
    position: relative;
    margin: 50px auto;
  }
 
  .loading {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    animation: rotate 2s infinite linear;
  }
 
  .loading div {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #3498db;
    border-radius: 50%;
    opacity: 0.7;
  }
 
  .loading div:nth-child(1) {
    transform: translateZ(50px);
    animation: bounce 2s infinite linear;
  }
 
  .loading div:nth-child(2) {
    background: #9b59b6;
    transform: translateZ(100px) rotateX(90deg);
    animation: bounce 2s infinite -1s linear;
  }
 
  .loading div:nth-child(3) {
    background: #f39c12;
    transform: translateZ(150px) rotateX(180deg);
    animation: bounce 2s infinite -2s linear;
  }
 
  .loading div:nth-child(4) {
    background: #1abc9c;
    transform: translateZ(100px) rotateX(270deg);
    animation: bounce 2s infinite -3s linear;
  }
 
  .loading div:nth-child(5) {
    background: #e74c3c;
    transform: translateZ(50px) rotateX(360deg);
    animation: bounce 2s infinite -4s linear;
  }
 
  @keyframes rotate {
    0% {
      transform: rotateX(0deg) rotateY(0deg);
    }
    100% {
      transform: rotateX(360deg) rotateY(360deg);
    }
  }
 
  @keyframes bounce {
    0%, 100% {
      transform: scale(0.5);
    }
    50% {
      transform: scale(1);
    }
  }
</style>
</head>
<body>
<div class="loading-container">
  <div class="loading">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</div>
</body>
</html>
现在已有 1 条评论,0 人点赞

广告

页底广告 页底广告
Comment
发表
  1. 头像
    @
    欢迎自取😀
    · Windows · Chrome · 中国香港特别行政区

    👍

    💖

    💯

    💦

    😄

    🪙

    👍 0 💖 0 💯 0 💦 0 😄 0 🪙 0
搜 索 消 息 足 迹
你还不曾留言过..
你还不曾留下足迹..
博主