SVG动画案例库
浏览精选的SVG动画案例
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 1000;
const VIEW_HEIGHT = 600;
// 粒子类型定义
interface Particle {
id: number;
x: number;
y: number;
speed: number;
radius: number;
opacity: number;
wobbleOffset: number;
type: 'reactor' | 'tube' | 'jar';
pathProgress?: number; // 0-1 for tube travel
}
export const HydrogenLabView = () => {
// 状态管理
const [bubbles, setBubbles] = useState<Particle[]>([]);
const [reactionProg
实验室制取氢气
移开即停止播放
```javascript
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 1000;
const VIEW_HEIGHT = 600;
const CENTER_X = VIEW_WIDTH / 2;
const CENTER_Y = VIEW_HEIGHT / 2;
// 粒子组件:背景漂浮的微粒
const Particle = ({ x, y, size, opacity }) => (
<circle cx={x} cy={y} r={size} fill="#fff" opacity={opacity} />
);
export const CovalentBondView = () => {
// 动画状态
// phase: 0-1 (approaching), 1-2 (bonding/stabilizing), 2-3 (holding), 3-4 (resetting)
const [t
共价键的形成
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 1000;
const VIEW_HEIGHT = 600;
const BACKGROUND_COLOR = '#e6e6e6';
// Utils
const randomRange = (min, max) => Math.random() * (max - min) + min;
// Types
type Particle = {
id: number;
x: number;
y: number;
type: 'image' | 'text' | 'audio';
color: string;
targetX: number;
targetY: number;
speed: number;
delay: number;
};
type Node = { x: number; y: number; layer: number };
生成一个训练模型所需要的完整的步骤。还有数据处理步骤,数据采
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 800;
const VIEW_HEIGHT = 600;
const DIALOGUE = [
{ id: 1, side: 'left', text: "Hello! Nice to meet you.", cn: "你好!很高兴见到你。" },
{ id: 2, side: 'right', text: "Hi there! I am Alice.", cn: "嗨!我是爱丽丝。" },
{ id: 3, side: 'left', text: "I am Bob. Do you speak English?", cn: "我是鲍勃。你会说英语吗?" },
{ id: 4, side: 'right', text: "Yes, I am learning it now.", cn: "是的,我现在正在学习。" },
{ id: 5, side: 'lef
生成两个小孩子在用英语对话的
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 800;
const VIEW_HEIGHT = 600;
const BG_COLOR = '#0f172a';
// Helper to generate random numbers
const random = (min, max) => Math.random() * (max - min) + min;
// Particle Interface
interface Particle {
id: number;
x: number;
y: number;
vx: number;
vy: number;
life: number;
type: 'water' | 'light' | 'co2' | 'nutrient';
}
export const PlantGrowthView = () => {
const [time, set
植物生长需要什么
移开即停止播放
```javascript
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
// ----------------------------------------------------------------------
// 物理引擎与常量定义
// ----------------------------------------------------------------------
const VIEW_WIDTH = 800;
const VIEW_HEIGHT = 500;
const PARTICLE_COUNT = 100; // 10x10 Grid
const PARTICLE_RADIUS = 4;
const GRID_SPACING = 25;
// 阶段定义
const PHASE_ORDER = 'ORDER'; // 有序 (晶体/低熵)
const PHASE_TRANSITION = 'TRANSITION';
给我一个熵增的过程动画
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
// 5x7 Pixel grids for digits 0-9
const DIGIT_PATTERNS = {
0: [
0,1,1,1,0,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
0,1,1,1,0
],
1: [
0,0,1,0,0,
0,1,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,0,1,0,0,
0,1,1,1,0
],
2: [
0,1,1,1,0,
1,0,0,0,1,
0,0,0,0,1,
0,0,0,1,0,
0,0,1,0,0,
0,1,0,0,0,
1,1,1,1,1
],
3: [
神经网络识别手写数字过程
移开即停止播放
'use client';
import React, { useState, useEffect, useRef, useMemo } from 'react';
const VIEW_WIDTH = 1000;
const VIEW_HEIGHT = 600;
export const TransformerFlowView = () => {
// 动画状态管理
const [phase, setPhase] = useState(0); // 0: Embed, 1: PosEnc, 2: Attention, 3: AddNorm, 4: FFN, 5: Output
const [tick, setTick] = useState(0);
// 模拟输入数据
const tokens = useMemo(() => [
{ text: "AI", id: 0 },
{ text: "将", id: 1 },
{ text: "改", id: 2 },
{ text: "变", id: 3 },
{ te
大模型transformers的执行流程图
广告
Ads移开即停止播放
'use client';
import React, { useState, useEffect, useMemo } from 'react';
const VIEW_WIDTH = 1000;
const VIEW_HEIGHT = 600;
// 粒子生成辅助函数
const generateParticles = (count, type) => {
return Array.from({ length: count }, (_, i) => ({
id: i,
delay: Math.random() * 5,
speed: 2 + Math.random() * 2,
offset: Math.random() * 40 - 20, // 路径偏移
scale: 0.5 + Math.random() * 0.5
}));
};
export const PhotosynthesisView = () => {
// 静态生成粒子数据,避免重渲染抖动
const photons = useMemo(() =>
描述植物的光合作用
移开即停止播放
```javascript
'use client';
import React, { useState, useEffect, useMemo, useRef } from 'react';
const VIEW_WIDTH = 800;
const VIEW_HEIGHT = 600;
const MOON_RADIUS = 140; // 稍微增大月球尺寸以增强视觉冲击力
const CENTER_X = VIEW_WIDTH / 2;
const CENTER_Y = VIEW_HEIGHT / 2 - 20;
// 星星生成逻辑
const generateStars = (count) => {
return Array.from({ length: count }, () => ({
x: Math.random() * VIEW_WIDTH,
y: Math.random() * VIEW_HEIGHT,
size: Math.random() * 1.5 + 0.5,
opacity: Math.random() * 0.8
月球的月相变化,可以3D立体呈现
移开即停止播放
'use client';
import React, { useEffect, useRef, useState } from 'react';
export const DialysisPrincipleView = () => {
const canvasRef = useRef<HTMLCanvasElement>(null);
const [stats, setStats] = useState({ flowRate: 300, clearance: 0 });
const containerRef = useRef<HTMLDivElement>(null);
// Configuration
const CONFIG = {
width: 800,
height: 500,
membraneY: 250,
particleCount: 120,
colors: {
bg: '#0f172a',
bloodBase: '#7f1d1d',
bloodCell: '#ef44