svg+css做个有声二维卡通动画片代码
代码语言:html
所属分类:其他
代码由deepseek-v4.1 ai生成,可能有错误,仅供参考:点击查看提示词
代码描述:二维卡通过有声动画片生成
代码标签: svg css 做个 有声 二维 卡通 动画片 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>一颗种子长成大树 · SVG 卡通短片(TTS 旁白版)</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
height: 100%;
background: #000;
overflow: hidden;
font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
#stage {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: #000;
}
#wrap {
position: relative;
width: min(100vw, 177.78vh);
height: min(56.25vw, 100vh);
container-type: inline-size;
overflow: hidden;
background: #0b1a10;
box-shadow: 0 0 60px rgba(0, 0, 0, .8);
}
#scene {
display: block;
width: 100%;
height: 100%;
}
#subtitle {
position: absolute;
left: 50%;
bottom: 4.5%;
transform: translateX(-50%);
padding: .42em 1.15em;
background: rgba(12, 22, 16, .68);
border-radius: 999px;
color: #fff;
font-weight: 800;
font-size: clamp(11px, 3.1cqw, 30px);
line-height: 1.3;
letter-spacing: .04em;
white-space: nowrap;
text-shadow: 0 2px 6px rgba(0, 0, 0, .8), 0 0 3px rgba(0, 0, 0, .95);
opacity: 0;
pointer-events: none;
will-change: opacity;
}
#playBtn {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
padding: .62em 1.5em;
font-family: inherit;
font-weight: 800;
font-size: clamp(15px, 4cqw, 36px);
letter-spacing: .08em;
color: #2E7D32;
background: #FFF6D5;
border: 5px solid #2E7D32;
border-radius: 999px;
cursor: pointer;
box-shadow: 0 8px 0 #1B5E20, 0 14px 28px rgba(0, 0, 0, .45);
transition: transform .12s ease, box-shadow .12s ease, opacity .35s ease;
z-index: 10;
}
#playBtn:hover { transform: translate(-50%, -53%) scale(1.04); }
#playBtn:active { transform: translate(-50%, -46%) scale(.97); box-shadow: 0 3px 0 #1B5E20; }
#playBtn.hidden { opacity: 0; pointer-events: none; }
</style>
</head>
<body>
<div id="stage">
<div id="wrap">
<!-- ==================== 场景(SVG) ==================== -->
<svg id="scene" viewBox="0 0 800 450" preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="skyGrad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#79CDF2"/>
<stop offset="58%" stop-color="#A8E2FA"/>
<stop offset="100%" stop-color="#DBF4FF"/>
</linearGradient>
<linearGradient id="soilGrad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#B07A50"/>
<stop offset="100%" stop-color="#66401F"/>
</linearGradient>
<radialGradient id="sunGlow">
<stop offset="0%" stop-color="#FFF3B0" stop-opacity=".95"/>
<stop offset="60%" stop-color=&quo.........完整代码请登录后点击上方下载按钮下载查看















网友评论0