鹈鹕代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>鹈鹕骑自行车 SVG 动画</title>
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: #87CEEB;
}
svg {
display: block;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice">
<defs>
<!-- 天空渐变 -->
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#BDE0FE" />
<stop offset="100%" stop-color="#87CEEB" />
</linearGradient>
<!-- 太阳光晕 -->
<radialGradient id="sunGlow" cx="0.5" cy="0.5" r="0.5">
<stop offset="0%" stop-color="#FFF7D1" stop-opacity="1" />
<stop offset="100%" stop-color="#FFF7D1" stop-opacity="0" />
</radialGradient>
<!-- 简单云朵 -->
<g id="cloud">
<ellipse cx="0" cy="0" rx="35" ry="18" fill="#FFFFFF" opacity="0.9"/>
<ellipse cx="25" cy="-6" rx="28" ry="20" fill="#FFFFFF" opacity="0.9"/>
<ellipse cx="50" cy="0" rx="30" ry="18" fill="#FFFFFF" opacity="0.9"/>
<ellipse cx="25" cy="8" rx="22" ry="12" fill="#FFFFFF" opacity="0.9"/>
</g>
</defs>
<!-- 背景 -->
<rect x="0" y="0" width="800" height="500" fill="url(#sky)" />
<!-- 太阳 -->
<g transform="translate(700, 80)">
<circle r="45" fill="url(#sunGlow)" opacity="0.6" />
<circle r="20" fill="#FFE082" />
</g>
<!-- 移动的云朵 -->
<g>
<use href="#cloud" transform="translate(0,0)">
<animateTransform attributeName="transform" type="translate"
from="900,80" to="-160,80" dur="13s" repeatCount="indefinite"/>
</use>
<use href="#cloud" transform="translate(0,0)">
<animateTransform attributeName="transform" type="translate"
from="950,160" to="-150,160" dur="18s" repeatCount="indefinite"/>
</use>
<use href="#cloud" transform="translate(0,0)">
<animateTransform attributeName="transform" type="translate"
from="1050,110" to="-100,110" dur="15s" repeatCount="indefinite"/>
</use>
</g>
<!-- 道路 -->
<rect x="0" y="380" width="800" height="120" fill="#555" />
<rect x="0" y="375" width="800" height="8" fill="#333" />
<!-- 路面虚线,向左移动 -->
<g>
<rect x="0" y="435" width="80" height="10" rx="5" fill="#DDD" />
<rect x="160" y="435" width="80" height="10" rx="5" fill="#DDD" />
<rect x="320" y="435" width="80" height="10" rx="5" fill="#DDD" />
<rect x="480" y="435" width="80" height="10" rx="5" fill="#DDD" />
<rect x="640" y="435" width="80" height="10" rx="5" fill="#DDD" />
<rect x="800" y="435" width="80" height="10" rx="5" fill="#DDD" />
<animateTransform attributeName="transform" type="translate"
from="0,0" to="-160,0" dur="0.63s" repeatCount="indefinite"/>
</g>
<!-- 车速线 -->
<g stroke="#FFF" stroke-width="2" opacity="0.3">
<line x1="820" y1="400" x2="760" y2="400">
<animateTransform attributeName="transform" type="translate"
from="0,0" to="-240,0" dur="0.8s" repeatCount="indefinite"/>
</line>
<line x1="840" y1="460" x2="780" y2="460">
<animateTransform attributeName="transform" type="translate"
from="0,0" to="-240,0" dur="0.9s" repeatCount="indefinite"/>
</line>
</g>
<!-- ========== 自行车 ========== -->
<!-- 后轮 -->
<g transform="translate(300,380)">
<circle r="60" fill="none" stroke="#2C3E50" stroke-width="8" />
<circle r="52" fill="none" stroke="#95A5A6" stroke-width="2" />
<g>
<line x1="0" y1="-52" x2="0" y2="52" stroke="#BDC3C7" stroke-width="3" />
<line x1="-52" y1="0" x2="52" y2="0" stroke="#BDC3C7" stroke-width="3" />
<line x1="-37" y1="-37" x2="37" y2="37" stroke="#BDC3C7" stroke-width="2" />
<line x1="-37" y1="37" x2="37" y2="-37" stroke="#BDC3C7" stroke-width="2" />
<animateTransform attributeName="transform" type="rotate"
from="0" to="360" dur="1.5s" repeatCount="indefinite"/>
</g>
</g>
<!-- 前轮 -->
<g transform="translate(500,380)">
<circle r="60" fill="none" stroke="#2C3E50" stroke-width="8" />
<circle r="52" fill="none" stroke="#95A5A6" stroke-width="2" />
<g>
<line x1="0" y1="-52" x2="0" y2="52" stroke="#BDC3C7" stroke-width="3" />
<line x1="-52" y1="0" x2="52" y2="0" stroke="#BDC3C7" stroke-width="3" />
<line x1="-37" y1="-37" x2="37" y2="37" stroke="#BDC3C7" stroke-width="2" />
<line x1="-37" y1="37" x2="37" y2="-37" stroke="#BDC3C7" stroke-width="2" />
<animateTransform attributeName="transform" type="rotate"
from="0" to="360" dur="1.5s" repeatCount="indefinite"/>
</g>
</g>
<!-- 远端那条腿(在车身后面) -->
<g>
<path fill="none" stroke="#DC7633" stroke-width="7" stroke-linecap="round" stroke-linejoin="round">
<animate attributeName="d" dur="1.5s" repeatCount="indefinite" calcMode="linear"
keyTimes="0;0.125;0.25;0.375;0.5;0.625;0.75;0.875;1"
values="
M350,305 Q393.6,330.7 382,380;
M350,305 Q394.4,320.7 387.3,367.3;
M350,305 Q397.6,313.7 400,362;
M350,305 Q402.5,314.9 412.7,367.3;
M350,305 Q406.2,322.3 418,380;
M350,305 Q405.8,331.4 412.7,392.7;
M350,305 Q401.4,337.3 400,398;
M350,305 Q396.3,337.1 387.3,392.7;
M350,305 Q393.6,330.7 382,380
"/>
</path>
</g>
<!-- 车架 -->
<g stroke="#E74C3C" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" fill="none">
<line x1="330" y1="295" x2="470" y2="270" /> <!-- 上管 -->
<line x1="470" y1="270" x2="500" y2="380" /> <!-- 前叉 -->
<line x1="330" y1="295" x2="400" y2="380" /> <!-- 立管 -->
<line x1="400" y1="380" x2="500" y2="380" /> <!-- 下管 -->
<line x1="330" y1="295" x2="300" y2="380" /> <!-- 座撑 -->
<line x1="300" y1="380" x2="400" y2="380" /> <!-- 链撑 -->
</g>
<!-- 车座 -->
<path d="M315,295 Q330,285 350,295 L345,302 Z" fill="#2C3E50" stroke="none" />
<!-- 车把 -->
<g stroke="#2C3E50" stroke-width="6" stroke-linecap="round" fill="none">
<line x1="470" y1="270" x2="490" y2="250" />
<path d="M485,250 Q500,240 510,255" />
</g>
<!-- 曲柄与脚踏板(旋转) -->
<g transform="translate(400,380)">
<circle r="18" fill="none" stroke="#555" stroke-width="4" />
<g>
<line x1="0" y1="-18" x2="0" y2="18" stroke="#444" stroke-width="5" stroke-linecap="round" />
<rect x="-8" y="-22" width="16" height="8" rx="2" fill="#222" />
<rect x="-8" y="14" width="16" height="8" rx="2" fill="#222" />
<animateTransform attributeName="transform" type="rotate"
from="0" to="360" dur="1.5s" repeatCount="indefinite"/>
</g>
</g>
<!-- ========== 鹈鹕 ========== -->
<!-- 近端那条腿 -->
<g>
<path fill="none" stroke="#FF9F43" stroke-width="10" stroke-linecap="round" stroke-linejoin="round">
<animate attributeName="d" dur="1.5s" repeatCount="indefinite" calcMode="linear"
keyTimes="0;0.125;0.25;0.375;0.5;0.625;0.75;0.875;1"
values="
M350,305 Q406.2,322.3 418,380;
M350,305 Q405.8,331.4 412.7,392.7;
M350,305 Q401.4,337.3 400,398;
M350,305 Q396.3,337.1 387.3,392.7;
M350,305 Q393.6,330.7 382,380;
M350,305 Q394.4,320.7 387.3,367.3;
M350,305 Q397.6,313.7 400,362;
M350,305 Q402.5,314.9 412.7,367.3;
M350,305 Q406.2,322.3 418,380
"/>
</path>
</g>
<!-- 身体主体 -->
<g>
<!-- 尾巴 -->
<path d="M280,250 L245,230 L250,270 Z" fill="#FFF" stroke="#2C3E50" stroke-width="2" />
<!-- 躯干 -->
<ellipse cx="340" cy="255" rx="70" ry="55" fill="#FDFEFE" stroke="#2C3E50" stroke-width="2" />
<!-- 阴影 -->
<ellipse cx="340" cy="285" rx="50" ry="15" fill="#E6EEF7" opacity="0.6" />
<!-- 翅膀(会轻微扇动) -->
<g>
<animateTransform attributeName="transform" type="rotate"
values="-5 330 245; 8 330 245; -5 330 245"
keyTimes="0;0.5;1" dur="0.8s" repeatCount="indefinite"/>
<path d="M330,245 Q290,260 270,285 Q310,285 340,265 Z"
fill="#95A5A6" stroke="#2C3E50" stroke-width="2" />
</g>
<!-- 脖子和头(会轻微摆动) -->
<g>
<animateTransform attributeName="transform" type="rotate"
values="-3 365 235; 3 365 235; -3 365 235"
keyTimes="0;0.5;1" dur="3s" repeatCount="indefinite"/>
<!-- 脖子 -->
<path d="M365,235 Q385,260 390,225 T420,210" fill="none" stroke="#FFF" stroke-width="22" stroke-linecap="round" />
<path d="M365,235 Q385,260 390,225 T420,210" fill="none" stroke="#2C3E50" stroke-width="24" stroke-linecap="round" opacity="0.15" />
<path d="M365,235 Q385,260 390,225 T420,210" fill="none" stroke="#FDFEFE" stroke-width="20" stroke-linecap="round" />
<!-- 头 -->
<circle cx="390" cy="215" r="28" fill="#FDFEFE" stroke="#2C3E50" stroke-width="2" />
<!-- 喙 -->
<path d="M410,208 Q470,210 500,235 Q455,260 405,245 Z"
fill="#FF9F43" stroke="#E67E22" stroke-width="2" />
<path d="M410,208 L500,235 L405,240 Z"
fill="#FFB84D" opacity="0.5" />
<!-- 眼睛 -->
<circle cx="400" cy="205" r="5" fill="#FFF" stroke="#2C3E50" stroke-width="1" />
<circle cx="401" cy="205" r="2" fill="#000" />
<!-- 头顶几根毛 -->
<path d="M392,190 Q395,175 402,188" fill="none" stroke="#2C3E50" stroke-width="2" />
</g>
</g>
</svg>
</body>
</html>