3D角色展示

先看效果:

再看代码:

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3D卡片悬停</title>
  <style>
    @font-face {
      font-family: "Exoct";
      src: url("https://assets.codepen.io/1480814/films.EXH_____.ttf")
    }
    figure {
      width: 100%;
      aspect-ratio: 1;
      margin: 0 0 60px;
      padding: 5px 20px 0;
      box-sizing: border-box;
      display: grid;
      grid-template-rows: 100%;
      cursor: pointer;
      position: relative;
      filter: drop-shadow(0 0 20px rgb(0 0 0/50%));
    }
    figure:before {
      content: "";
      position: absolute;
      z-index: -1;
      inset: 0;
      background: top/cover;
      transform-origin: bottom;
      filter: brightness(.9);
      transition: .5s;
    }
    figure:before {
      background-image: url(https://assets.codepen.io/1480814/necro-back.jpg)
    }
    figure + figure:before {
      background-image: url(https://assets.codepen.io/1480814/druid-bac.jpg)
    }
    img {
      grid-area: 1/1;
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: top;
      filter: contrast(.8) brightness(.7);
      place-self: end center;
      transition: .5s;
    }
    figcaption {
      grid-area: 1/1;
      width: calc(100% + 40px);
      font-family: Exoct;
      color: #fff;
      font-size: min(32px,5vmin);
      text-align: center;
      place-self: end center;
      transform: perspective(500px) translateY(100%) rotateX(-90deg);
      backface-visibility: hidden;
      transform-origin: top;
      background: #000;
      transition: .5s;
    }
    figure:hover img {
      width: 130%;
      height: 255%;
      filter: contrast(1);
    }
    figure:hover::before {
      filter: brightness(.3);
      transform: perspective(500px) rotateX(60deg);
    }
    figure:hover figcaption{
      transform: perspective(500px)translateY(100%) rotateX(-30deg);
    }

    body {
      margin: 0;
      min-height: 100vh;
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: min(230px,35vmin);
      place-content: end center;
      gap: 50px;
      background:
              linear-gradient(#0000,rgb(50 50 50 / 88%)),
              url(https://assets.codepen.io/1480814/diablo-reaper-of-souls-mw-1360x768.jpg) top/cover;
    }

  </style>
</head>
<body>
<figure>
  <img src="https://assets.codepen.io/1480814/necro.png" alt="Necromancer">
  <figcaption>The Necro</figcaption>
</figure>
<figure>
  <img src="https://assets.codepen.io/1480814/druide.png" alt="Druid">
  <figcaption>The Druid</figcaption>
</figure>

</body>
</html>
相关推荐
寻星探路1 小时前
【前端基础】HTML + CSS + JavaScript 快速入门(三):JS 与 jQuery 实战
java·前端·javascript·css·c++·ai·html
Highcharts.js10 小时前
什么是散点图?一文学会Highcharts散点图的核心特性与3D扩展应用
javascript·3d·开发文档·散点图·highcharts·图表类型
ai_xiaogui10 小时前
【腾讯开源】Hunyuan3D-Motion 实战:从 26GB 大模型环境配置到 AIStarter 一键本地部署全指南
3d·混元3d-motion·3d动画生成·腾讯混元开源模型·aistarter一键部署·fbx模型导出·pytorch环境配置
henry10101012 小时前
DeepSeek生成的网页版小游戏 - 冰壶
前端·javascript·css·html5
键盘鼓手苏苏12 小时前
Flutter for OpenHarmony:injector 轻量级依赖注入库(比 GetIt 更简单的选择) 深度解析与鸿蒙适配指南
css·网络·flutter·华为·rust·harmonyos
PieroPc13 小时前
2026年,我的AI编程助手使用心得(纯个人体验,非评测)
javascript·css·html·fastapi·ai编程
CappuccinoRose1 天前
CSS 语法学习文档(十三)
前端·css·学习·postcss·模块化·预处理器
niuniudengdeng1 天前
一种基于高维物理张量与XRF实景复刻的一步闭式解工业级3D打印品生成模型
人工智能·python·数学·算法·3d
MaoziShan2 天前
[WACV‘26] 不用给每一帧“打关键点”,也能做出可动画的3D狗:4D-Animal 把成本从“人工标注”转移到“密集线索 + 工具链”
人工智能·3d
QmZVLlLHvXq2 天前
汇川多合一上位机软件 支持宇通,东风凯普特,陕汽德龙等多车型 支持数据读取,修改,故障码读取
css3