cos-design 3.5.5 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +1709 -517
- package/dist/src/components/bubbleField/background.d.ts +3 -0
- package/dist/src/components/bubbleField/constants.d.ts +10 -0
- package/dist/src/components/bubbleField/index.d.ts +5 -0
- package/dist/src/components/bubbleField/merge.d.ts +5 -0
- package/dist/src/components/bubbleField/physics.d.ts +12 -0
- package/dist/src/components/bubbleField/render.d.ts +3 -0
- package/dist/src/components/bubbleField/types.d.ts +81 -0
- package/dist/src/components/bubbleField/utils.d.ts +6 -0
- package/dist/src/components/countUp/index.d.ts +19 -0
- package/dist/src/components/gameOfLife/index.d.ts +17 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/components/networkGraph/index.d.ts +24 -0
- package/dist/src/components/sandFall/index.d.ts +13 -0
- package/dist/src/components/splitText/index.d.ts +21 -0
- package/dist/src/components/springMass/index.d.ts +17 -0
- package/dist/src/components/textMorph/index.d.ts +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const drawStaticBackground: (ctx: CanvasRenderingContext2D, width: number, height: number, tint: string) => void;
|
|
2
|
+
export declare const drawDynamicBackground: (ctx: CanvasRenderingContext2D, width: number, height: number, time: number, snowSprite: HTMLCanvasElement, reduceMotion: boolean) => void;
|
|
3
|
+
export declare const createSnowSprite: () => HTMLCanvasElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PointerState } from './types';
|
|
2
|
+
export declare const BLOB_SEGMENTS = 48;
|
|
3
|
+
export declare const META_SEGMENTS = 56;
|
|
4
|
+
export declare const LIGHT_X = 0.82;
|
|
5
|
+
export declare const LIGHT_Y = 0.08;
|
|
6
|
+
export declare const MAX_RADIUS = 46;
|
|
7
|
+
export declare const MAX_DPR = 2;
|
|
8
|
+
export declare const FRAME_MS: number;
|
|
9
|
+
export declare const MERGE_CELL_SIZE: number;
|
|
10
|
+
export declare const createPointerState: () => PointerState;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ActiveMerge, Bubble, MergePose } from './types';
|
|
2
|
+
export declare const resolveMergePose: (merge: ActiveMerge) => MergePose;
|
|
3
|
+
export declare const applyMergeAttraction: (bubbles: Bubble[]) => void;
|
|
4
|
+
export declare const startNearbyMerges: (bubbles: Bubble[], merges: ActiveMerge[], busyIds: Set<number>) => void;
|
|
5
|
+
export declare const updateMerges: (bubbles: Bubble[], merges: ActiveMerge[], speedScale: number, frameScale: number) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Bubble } from './types';
|
|
2
|
+
export declare const createSeabedBubble: (id: number, width: number, height: number, speed: number, deep?: boolean) => Bubble;
|
|
3
|
+
export declare const integrateBubbleMotion: (bubble: Bubble, time: number, height: number, speedScale: number, frameScale: number) => void;
|
|
4
|
+
export declare const samplePointerFlow: (bx: number, by: number, px: number, py: number, pvx: number, pvy: number, pSpeed: number) => {
|
|
5
|
+
fx: number;
|
|
6
|
+
fy: number;
|
|
7
|
+
strain: number;
|
|
8
|
+
strainAngle: number;
|
|
9
|
+
excite: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const integrateSurfaceModes: (bubble: Bubble, frameScale: number) => void;
|
|
12
|
+
export declare const exciteBubbleFromFlow: (bubble: Bubble, strain: number, strainAngle: number, excite: number, fx: number, fy: number) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Bubble } from './types';
|
|
2
|
+
export declare const drawBubble: (ctx: CanvasRenderingContext2D, bubble: Bubble, time: number, tint: string, width: number, height: number) => void;
|
|
3
|
+
export declare const drawMergingPair: (ctx: CanvasRenderingContext2D, ax: number, ay: number, ar: number, bx: number, by: number, br: number, tint: string, width: number, height: number, alpha: number) => void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface BubbleFieldProps {
|
|
2
|
+
width?: number;
|
|
3
|
+
height?: number;
|
|
4
|
+
/** 气泡数量上限 */
|
|
5
|
+
bubbleCount?: number;
|
|
6
|
+
/** 上浮速度 */
|
|
7
|
+
speed?: number;
|
|
8
|
+
/** 水体主色 */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** 是否启用鼠标划过扰动 */
|
|
11
|
+
interactive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface PointerState {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
prevX: number;
|
|
17
|
+
prevY: number;
|
|
18
|
+
vx: number;
|
|
19
|
+
vy: number;
|
|
20
|
+
speed: number;
|
|
21
|
+
active: boolean;
|
|
22
|
+
lastTs: number;
|
|
23
|
+
}
|
|
24
|
+
export interface Bubble {
|
|
25
|
+
id: number;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
radius: number;
|
|
29
|
+
/** 目标终端上升速度(向上为正) */
|
|
30
|
+
terminalRise: number;
|
|
31
|
+
drift: number;
|
|
32
|
+
vx: number;
|
|
33
|
+
/** 竖直速度,向上为负(屏幕坐标) */
|
|
34
|
+
vy: number;
|
|
35
|
+
phase: number;
|
|
36
|
+
alpha: number;
|
|
37
|
+
/** 轻微椭圆度(接近 1 = 近球形) */
|
|
38
|
+
aspect: number;
|
|
39
|
+
deformAmp: number;
|
|
40
|
+
deformPhase: number;
|
|
41
|
+
deformSpeed: number;
|
|
42
|
+
tilt: number;
|
|
43
|
+
pulseBoost: number;
|
|
44
|
+
/** 粘性拉伸强度(沿相对流速) */
|
|
45
|
+
streamStretch: number;
|
|
46
|
+
/** 拉伸主轴方向 */
|
|
47
|
+
streamAngle: number;
|
|
48
|
+
/** 二阶表面模态振幅(椭圆振荡) */
|
|
49
|
+
mode2: number;
|
|
50
|
+
mode2Vel: number;
|
|
51
|
+
mode2Angle: number;
|
|
52
|
+
/** 三阶表面模态振幅(非对称抖动) */
|
|
53
|
+
mode3: number;
|
|
54
|
+
mode3Vel: number;
|
|
55
|
+
mode3Phase: number;
|
|
56
|
+
/** 融合后短暂振荡(快速衰减) */
|
|
57
|
+
settle: number;
|
|
58
|
+
}
|
|
59
|
+
export interface MergePose {
|
|
60
|
+
ax: number;
|
|
61
|
+
ay: number;
|
|
62
|
+
ar: number;
|
|
63
|
+
bx: number;
|
|
64
|
+
by: number;
|
|
65
|
+
br: number;
|
|
66
|
+
approach: number;
|
|
67
|
+
absorb: number;
|
|
68
|
+
}
|
|
69
|
+
export interface ActiveMerge {
|
|
70
|
+
primaryId: number;
|
|
71
|
+
secondaryId: number;
|
|
72
|
+
progress: number;
|
|
73
|
+
targetRadius: number;
|
|
74
|
+
startPrimaryRadius: number;
|
|
75
|
+
startSecondaryRadius: number;
|
|
76
|
+
startPrimaryX: number;
|
|
77
|
+
startPrimaryY: number;
|
|
78
|
+
startSecondaryX: number;
|
|
79
|
+
startSecondaryY: number;
|
|
80
|
+
pose?: MergePose;
|
|
81
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const easeInOut: (t: number) => number;
|
|
2
|
+
export declare const easeOutCubic: (t: number) => number;
|
|
3
|
+
export declare const smoothstep: (edge0: number, edge1: number, x: number) => number;
|
|
4
|
+
export declare const frameDamp: (value: number, frameScale: number) => number;
|
|
5
|
+
export declare const hash01: (n: number) => number;
|
|
6
|
+
export declare const terminalRiseForRadius: (radius: number, speed: number, randomize?: boolean) => number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CountUpProps {
|
|
3
|
+
/** 目标值 */
|
|
4
|
+
value: number;
|
|
5
|
+
/** 起始值 */
|
|
6
|
+
start?: number;
|
|
7
|
+
/** 动画时长(毫秒) */
|
|
8
|
+
duration?: number;
|
|
9
|
+
/** 小数位数 */
|
|
10
|
+
decimals?: number;
|
|
11
|
+
/** 前缀 */
|
|
12
|
+
prefix?: string;
|
|
13
|
+
/** 后缀 */
|
|
14
|
+
suffix?: string;
|
|
15
|
+
/** 主色 */
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const CountUp: React.FC<CountUpProps>;
|
|
19
|
+
export default CountUp;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface GameOfLifeProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
/** 单元格大小 */
|
|
6
|
+
cellSize?: number;
|
|
7
|
+
/** 演化速度(毫秒/代) */
|
|
8
|
+
speed?: number;
|
|
9
|
+
/** 初始存活密度 0~1 */
|
|
10
|
+
density?: number;
|
|
11
|
+
/** 存活颜色 */
|
|
12
|
+
aliveColor?: string;
|
|
13
|
+
/** 网格线颜色 */
|
|
14
|
+
gridColor?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const GameOfLife: React.FC<GameOfLifeProps>;
|
|
17
|
+
export default GameOfLife;
|
|
@@ -17,6 +17,7 @@ export { default as CyberGrid } from './cyberGrid';
|
|
|
17
17
|
export type { CyberGridProps } from './cyberGrid';
|
|
18
18
|
export type { ConfettiHandle, ConfettiProps } from './confetti';
|
|
19
19
|
export { default as Countdown } from './countdown';
|
|
20
|
+
export { default as CountUp } from './countUp';
|
|
20
21
|
export { default as DnaHelix } from './dnaHelix';
|
|
21
22
|
export type { DnaHelixProps } from './dnaHelix';
|
|
22
23
|
export { default as ElectricArc } from './electricArc';
|
|
@@ -31,9 +32,12 @@ export type { DoublePendulumProps } from './doublePendulum';
|
|
|
31
32
|
export { default as Fireworks } from './fireworks';
|
|
32
33
|
export type { FireworksHandle, FireworksProps } from './fireworks';
|
|
33
34
|
export { default as FlipCounter } from './flipCounter';
|
|
35
|
+
export type { CountUpProps } from './countUp';
|
|
34
36
|
export { default as GradientFlow } from './gradientFlow';
|
|
35
37
|
export type { GradientFlowProps } from './gradientFlow';
|
|
36
38
|
export type { FlipCounterProps } from './flipCounter';
|
|
39
|
+
export { default as GameOfLife } from './gameOfLife';
|
|
40
|
+
export type { GameOfLifeProps } from './gameOfLife';
|
|
37
41
|
export { default as GlitchText } from './glitchText';
|
|
38
42
|
export { default as GravityBalls } from './gravityBalls';
|
|
39
43
|
export type { GravityBallsProps } from './gravityBalls';
|
|
@@ -56,6 +60,8 @@ export type { MazeGeneratorProps } from './mazeGenerator';
|
|
|
56
60
|
export type { MatrixRainProps } from './matrixRain';
|
|
57
61
|
export { default as MeteorRain } from './meteorRain';
|
|
58
62
|
export type { MeteorRainProps } from './meteorRain';
|
|
63
|
+
export { default as NetworkGraph } from './networkGraph';
|
|
64
|
+
export type { NetworkGraphEdge, NetworkGraphNode, NetworkGraphProps } from './networkGraph';
|
|
59
65
|
export { default as NeonText } from './neonText';
|
|
60
66
|
export { default as NewtonCradle } from './newtonCradle';
|
|
61
67
|
export type { NewtonCradleProps } from './newtonCradle';
|
|
@@ -66,6 +72,8 @@ export { default as ParticleNetwork } from './particleNetwork';
|
|
|
66
72
|
export { default as PlasmaBall } from './plasmaBall';
|
|
67
73
|
export type { PlasmaBallProps } from './plasmaBall';
|
|
68
74
|
export { default as SmokeFog } from './smokeFog';
|
|
75
|
+
export { default as BubbleField } from './bubbleField';
|
|
76
|
+
export type { BubbleFieldProps } from './bubbleField';
|
|
69
77
|
export { default as SolarSystem } from './solarSystem';
|
|
70
78
|
export type { SolarSystemProps } from './solarSystem';
|
|
71
79
|
export type { SmokeFogProps } from './smokeFog';
|
|
@@ -95,13 +103,21 @@ export { default as ScratchCard } from './scratchCard';
|
|
|
95
103
|
export type { ScratchCardProps } from './scratchCard';
|
|
96
104
|
export { default as SlotMachine } from './slotMachine';
|
|
97
105
|
export type { SlotMachineProps } from './slotMachine';
|
|
106
|
+
export { default as SandFall } from './sandFall';
|
|
107
|
+
export type { SandFallProps } from './sandFall';
|
|
98
108
|
export { default as SplitReveal } from './splitReveal';
|
|
99
109
|
export type { SplitRevealProps } from './splitReveal';
|
|
110
|
+
export { default as SplitText } from './splitText';
|
|
111
|
+
export type { SplitTextProps } from './splitText';
|
|
112
|
+
export { default as SpringMass } from './springMass';
|
|
113
|
+
export type { SpringMassProps } from './springMass';
|
|
100
114
|
export { default as Spotlight } from './spotlight';
|
|
101
115
|
export type { SpotlightProps } from './spotlight';
|
|
102
116
|
export type { ReturnCityProps } from './returnCity';
|
|
103
117
|
export type { TurntablePrize, TurntableProps } from './turntable';
|
|
104
118
|
export { default as Turntable } from './turntable';
|
|
119
|
+
export { default as TextMorph } from './textMorph';
|
|
120
|
+
export type { TextMorphProps } from './textMorph';
|
|
105
121
|
export { default as Typewriter } from './typewriter';
|
|
106
122
|
export type { TypewriterProps } from './typewriter';
|
|
107
123
|
export { default as WaveButton } from './waveButton';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface NetworkGraphNode {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface NetworkGraphEdge {
|
|
8
|
+
source: string;
|
|
9
|
+
target: string;
|
|
10
|
+
}
|
|
11
|
+
export interface NetworkGraphProps {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
/** 节点列表 */
|
|
15
|
+
nodes?: NetworkGraphNode[];
|
|
16
|
+
/** 边列表 */
|
|
17
|
+
edges?: NetworkGraphEdge[];
|
|
18
|
+
/** 连线颜色 */
|
|
19
|
+
linkColor?: string;
|
|
20
|
+
/** 节点半径 */
|
|
21
|
+
nodeRadius?: number;
|
|
22
|
+
}
|
|
23
|
+
declare const NetworkGraph: React.FC<NetworkGraphProps>;
|
|
24
|
+
export default NetworkGraph;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SandFallProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
/** 像素格大小 */
|
|
6
|
+
cellSize?: number;
|
|
7
|
+
/** 沙粒颜色列表(仅支持 #RRGGBB) */
|
|
8
|
+
colors?: string[];
|
|
9
|
+
/** 每帧生成粒子数 */
|
|
10
|
+
spawnRate?: number;
|
|
11
|
+
}
|
|
12
|
+
declare const SandFall: React.FC<SandFallProps>;
|
|
13
|
+
export default SandFall;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SplitTextProps {
|
|
3
|
+
/** 显示文字 */
|
|
4
|
+
text?: string;
|
|
5
|
+
/** 动画类型 */
|
|
6
|
+
animation?: 'fadeUp' | 'scale' | 'rotate' | 'blur';
|
|
7
|
+
/** 字符间隔延迟(毫秒) */
|
|
8
|
+
stagger?: number;
|
|
9
|
+
/** 单字符动画时长(毫秒) */
|
|
10
|
+
duration?: number;
|
|
11
|
+
/** 是否循环播放 */
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
/** 循环间歇(毫秒) */
|
|
14
|
+
loopPause?: number;
|
|
15
|
+
/** 字号 */
|
|
16
|
+
fontSize?: number;
|
|
17
|
+
/** 颜色 */
|
|
18
|
+
color?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const SplitText: React.FC<SplitTextProps>;
|
|
21
|
+
export default SplitText;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SpringMassProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
/** 横向质点数量 */
|
|
6
|
+
cols?: number;
|
|
7
|
+
/** 纵向质点数量 */
|
|
8
|
+
rows?: number;
|
|
9
|
+
/** 弹簧刚度 0~1 */
|
|
10
|
+
stiffness?: number;
|
|
11
|
+
/** 速度阻尼 0~1 */
|
|
12
|
+
damping?: number;
|
|
13
|
+
/** 主色 */
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const SpringMass: React.FC<SpringMassProps>;
|
|
17
|
+
export default SpringMass;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface TextMorphProps {
|
|
3
|
+
/** 轮播文案 */
|
|
4
|
+
texts?: string[];
|
|
5
|
+
/** 切换周期(毫秒) */
|
|
6
|
+
interval?: number;
|
|
7
|
+
/** 单次 morph 时长(毫秒) */
|
|
8
|
+
duration?: number;
|
|
9
|
+
/** 字号 */
|
|
10
|
+
fontSize?: number;
|
|
11
|
+
/** 主色 */
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const TextMorph: React.FC<TextMorphProps>;
|
|
15
|
+
export default TextMorph;
|