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>
相关推荐
3DVisionary16 小时前
掌控发动机“心脏”精度:蓝光3D扫描在凸轮轴全尺寸检测中的应用
3d·图形渲染·汽车发动机·精密测量·蓝光3d扫描·凸轮轴检测·形位公差
coder攻城狮1 天前
VTK系列1:在屏幕绘制多边形
c++·3d
会编程的土豆1 天前
新手前端小细节
前端·css·html·项目
PHOSKEY1 天前
3D工业相机如何“读透”每一个字符?快速识别、高精度3D测量
数码相机·3d
珹洺1 天前
Bootstrap-HTML(二)深入探索容器,网格系统和排版
前端·css·bootstrap·html·dubbo
BillKu1 天前
VS Code HTML CSS Support 插件详解
前端·css·html
XX風1 天前
7.2 harris 3d
3d
多恩Stone1 天前
【3D-AICG 系列-3】Trellis 2 的O-voxel (下) Material: Volumetric Surface Attributes
人工智能·3d·aigc
多恩Stone1 天前
【3D-AICG 系列-1】Trellis v1 和 Trellis v2 的区别和改进
人工智能·pytorch·python·算法·3d·aigc
三年模拟五年烧烤1 天前
easy-threesdk快速一键搭建threejs3d可视化场景
3d·threejs