3D文字动态效果edit icon

Fork(复制)
下载
嵌入
设置
BUG反馈
index.html
现在支持上传本地图片了!
            
            <!DOCTYPE html>
<html>
<head>
<style>
/* 初始化系统 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #ffb3c6;  /* 主粉色调 */
  --accent: #ff5c8a;   /* 强调色调 */
  --depth: 0.4vw;      /* 立体深度 */
  --glow-speed: 20s;   /* 渐变速度 */
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1a0a24;
  font-family: 'Arial Black', sans-serif;
  perspective: 1200px;
}

/* 3D文字容器 */
.text-3d {
  position: relative;
  font-size: 8vw;
  font-weight: 900;
  color: var(--primary);
  transform-style: preserve-3d;
  animation: float 8s ease-in-out infinite;
}

/* 立体层构造 */
.text-3d span {
  position: absolute;
  transform-style: preserve-3d;
}

/* 基础文字层 */
.text-3d > span:nth-child(1) {
  color: var(--primary);
  text-shadow: 
    0 0 10px rgba(255,92,138,0.5),
    0 0 30px rgba(255,92,138,0.3);
  z-index: 3;
}

/* 背面立体层 */
.text-3d > span:nth-child(2) {
  transform: 
    translateZ(calc(var(--depth) * -1))
    rotateX(5deg);
  color: transparent;
  text-shadow: 
    0 0 var(--depth) var(--accent),
    0 0 calc(var(--depth)*3) var(--accent);
  filter: blur(0.5px);
  z-index: 1;
}

/* 渐变光效层 */
.text-3d::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--accent) 40%,
    #ff8fab 70%,
    var(--primary) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: colorFlow var(--glow-speed) linear infinite;
  z-index: 2;
}

/* 环境光层 */
.text-3d::before {
  content: '';
  position: absolute;
  width: 150%;
  height: 150%;
  background: radial-gradient(
    circle,
    rgba(255,179,198,0.2) 0%,
    transparent 60%
  );
  filter: blur(30px);
  animation: glowMove 15s linear infinite;
  z-index: 0;
}

/* 关键帧动画 */
@keyframes colorFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glowMove {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(50%, 50%) rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(15deg); }
  50% { transform: translateY(-5vh) rotateX(25deg); }
}
</style>
</head>
<body>
  <div class="text-3d" data-text="GLOW">
    <span>GLOW</span>
    <span>GLOW</span>
  </div>
</body>
</html>
        
预览
控制台