3D堆叠卡片

复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D堆叠卡片</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: #313131;
        perspective: 2500px;
      }
      .container {
        position: relative;
        top: 150px;
        left: 150px;
        width: 300px;
        height: 400px;
        transform-style: preserve-3d;
        transform: rotateY(20deg);
      }
      .card {
        position: absolute;
        top: 0;
        width: 300px;
        height: 300px;
        background: #4a4a4a;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        transition: .5s;
        font-size: 2em;
        -webkit-text-stroke: 1px #fff5;
        color: transparent;
        font-weight: 700;
        padding: 10px;
        border: 1px solid rgba(0, 0, 0, 1);
        transition: .5s;
      }
      .container .card:hover {
        opacity: 1;
        transition: 0.01s;
        top: -15%;
        color: #333;
        box-shadow: 0 0 50px #64ff74, inset 0 0 120px #64ff74;
        background: #64ff74;
      }
    </style>
</head>
<body>
  <div class="container"></div>
  <script>
    const container = document.querySelector('.container');
    const cardCount = 12;
    for(let i = 0; i < cardCount; i++) {
      const card = document.createElement('div');
      card.classList.add('card');
      card.textContent = `${i + 1}`;
      let zPos = i * -120;
      let yPos = i * -20;
      card.style.transform = `translateZ(${zPos}px) translateY(${yPos}px)`;
      card.style.filter = `hue-rotate(${i * 30}deg)`;
      container.appendChild(card);
    }
  </script>
</body>
</html>
相关推荐
ejinxian17 分钟前
谷歌发布 Project Genie:基于文本生成可互动 3D 虚拟世界
人工智能·3d·project genie
a177988771221 分钟前
小程序为什么 Upload 外层使用 display: flex 时会造成组件样式混乱
css·html·css3
CG_MAGIC30 分钟前
3ds Max场景烘焙:大型建筑/道具的光照贴图批量生成
3d·blender·贴图·zbrush·建模教程·渲云渲染
咩咩不吃草1 小时前
【HTML】核心标签与【Python爬虫库】实战指南
css·爬虫·python·html
2401_863801462 小时前
不同类型的3D文件:简明易懂的指南
3d
霍理迪2 小时前
CSS移动端开发及less使用方法
前端·css
新启航光学频率梳2 小时前
深地钻探用钻杆深孔孔深光学3D轮廓测量-激光频率梳3D轮廓技术
科技·3d·制造
多恩Stone2 小时前
【3DV 进阶-12】Trellis.2 数据处理脚本细节
人工智能·pytorch·python·算法·3d·aigc
小宇的天下2 小时前
innovus User Guide---Design Methodology for 3D IC withThrough Silicon Via(11)
3d
esmap2 小时前
Clawdbot与ESMAP数字孪生技术融合分析
人工智能·计算机视觉·3d·ai·js