SVG动画案例库

浏览精选的SVG动画案例

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 600; // 辅助函数:生成随机数 const random = (min: number, max: number) => Math.random() * (max - min) + min; // 粒子类型定义 interface Particle { id: number; x: number; y: number; size: number; speedY: number; opacity: number; phase: number; } // 信号包类型 interface SignalPacket { id: number; progress: number; // 0 to 1 direction: 'toSH' | 'toCS'; // Changsha to Sh

女孩去了湖南省长沙市的中南大学,男孩去了上海市的上海交通大学

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; // ----------------------------------------------------------------------------- // Constants & Configuration // ----------------------------------------------------------------------------- const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 600; const CENTER_X = VIEW_WIDTH / 2; const CENTER_Y = VIEW_HEIGHT / 2; // Orbital Parameters const A = 350; // Semi-major axis const ECCENTRICITY = 0.6; // High eccentricity to

开普勒第二定律

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 600; const GROUND_Y = 500; // 辅助函数:生成随机山脉路径 const generateMountainPath = (width: number, height: number, peaks: number, complexity: number) => { let d = `M0 ${height}`; const step = width / peaks; for (let i = 0; i <= peaks; i++) { const x = i * step; // 随机高度,叠加正弦波使山脉更自然 const y = height - (Math.random() * complexity + 50) - Math.sin(i) * 20; d

在一个深色渐变背景上,设计一个极简风格的小人奔跑动画。小人由

移开即停止播放
```javascript 'use client'; import React, { useState, useEffect, useMemo, useRef } from 'react'; // ----------------------------------------------------------------------------- // CONSTANTS & CONFIGURATION // ----------------------------------------------------------------------------- const WIDTH = 1200; const HEIGHT = 700; const BACKGROUND_COLOR = '#0f172a'; // Slate-900 const PRIMARY_COLOR = '#38bdf8'; // Sky-400 (Orders) const SECONDARY_COLOR = '#34d399'; // Emerald-400 (Goods) const

生成《第五项修炼》啤酒游戏的系统思考动态因果循环图,满足以下

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 600; const ROAD_Y = 400; const STOP_LINE_X = 700; const CAR_WIDTH = 120; const CAR_HEIGHT = 50; const BUFFER_DISTANCE = 40; // distance between cars type LightState = 'red' | 'yellow' | 'green'; interface Car { id: number; x: number; speed: number; color: string; type: 'sedan' | 'sport' | 'truck'; lane: number; } export const TrafficLightSimulation = ()

做一个马路红路灯和车辆路过时的演示动画,演示红灯停绿灯行

移开即停止播放
'use client'; import React, { useState, useEffect, useMemo, useRef } from 'react'; const VIEW_WIDTH = 1200; const VIEW_HEIGHT = 800; const CENTER_X = VIEW_WIDTH / 2; const CENTER_Y = VIEW_HEIGHT / 2; // 行星配置数据 const PLANETS_DATA = [ { name: "水星 (Mercury)", color: "#A5A5A5", size: 4, radius: 60, speed: 4.1, colorStop: "#E0E0E0" }, { name: "金星 (Venus)", color: "#E2B669", size: 7, radius: 90, speed: 2.6, colorStop: "#F5D799" }, { name: "地球 (Earth)", color: "#4F83CC", size: 7.5, radius: 130

太阳系动画

广告

Ads
移开即停止播放
'use client'; import React, { useState, useEffect, useMemo } from 'react'; export const KunKunBasketballView = () => { const [time, setTime] = useState(0); const [mode, setMode] = useState<'dribble' | 'shrug'>('dribble'); // Animation loop logic useEffect(() => { let animationFrameId: number; const startTime = Date.now(); const animate = () => { const now = Date.now(); const elapsed = (now - startTime) / 1000; setTime(elapsed); // Switch mod

生成一个坤坤打篮球

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; const VIEW_WIDTH = 1200; const VIEW_HEIGHT = 800; const BG_COLOR = '#0f172a'; const HONEY_COLOR = '#fbbf24'; const TECH_BLUE = '#22d3ee'; const TEXT_COLOR = '#e2e8f0'; // Math Helpers const toRad = (deg: number) => (deg * Math.PI) / 180; const lerp = (start: number, end: number, t: number) => start + (end - start) * t; const easeOutCubic = (t: number): number => 1 - Math.pow(1 - t, 3); const easeInOutSine = (x:

人们注意到,蜜蜂在构筑巢穴时,蜂房结构为六角柱体,它的开口端

移开即停止播放
```jsx import React, { useState, useEffect, useMemo, useRef } from 'react'; const ChineseHistoryMap = () => { const [currentIndex, setCurrentIndex] = useState(0); const [progress, setProgress] = useState(0); const [prevIndex, setPrevIndex] = useState(null); // 动画配置 const DURATION_PER_ERA = 8000; // 延长单朝代展示时间以增强沉浸感 const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 700; // 数据源:增加开国皇帝 (emperor) 字段,微调描述 const dynasties = useMemo(() => [ { id: 'qin', name: '秦',

中国历史各个朝代变更,需要表现出各个朝代的名字、时间、以及疆

移开即停止播放
'use client'; import React, { useState, useEffect, useRef, useMemo } from 'react'; const VIEW_WIDTH = 1000; const VIEW_HEIGHT = 600; // Helper for smooth animation loop const useAnimationFrame = (callback) => { const requestRef = useRef(); const previousTimeRef = useRef(); const animate = time => { if (previousTimeRef.current != undefined) { const deltaTime = time - previousTimeRef.current; callback(deltaTime, time); } previousTimeRef.current = time; request

把这首古诗所描绘的景象画出来:“鹅鹅鹅,曲项向天歌。白毛浮绿

移开即停止播放
```javascript 'use client'; import React, { useState, useEffect, useMemo } from 'react'; // --- 配置常量 --- const VIEW_WIDTH = 800; const VIEW_HEIGHT = 500; const COLORS = { bg: "#ebeef4", grid: "#cbd5e1", textMain: "#334155", // Slate 700 textSub: "#64748b", // Slate 500 primary: "#0ea5e9", // Sky 500 (主句) secondary: "#8b5cf6", // Violet 500 (从句) accent: "#f59e0b", // Amber 500 (高亮/逻辑) success: "#10b981", // Emerald 500 (完成) white: "#ffffff", shadow: "rgba(148, 163, 184,

用动画表示英语定语从句的规则