@xdy-npm/react-particle-backgrounds 1.0.3 → 1.2.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/README.md +5 -2
- package/dist/index.d.ts +16 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +990 -903
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-particle-backgrounds
|
|
2
2
|
|
|
3
|
-
一个基于 [tsparticles](https://particles.js.org/)
|
|
3
|
+
一个基于 [tsparticles](https://particles.js.org/)、Three.js 和 Canvas 2D 的 React 粒子背景组件库,提供 **8 种精美粒子背景主题**。
|
|
4
4
|
|
|
5
5
|
开发与发布相关说明(Vite 库模式搭建、npm 发布、面试要点)见仓库内 [docs 目录](./docs/README.md)(该目录仅随 Git 维护,**不会**随 `npm install` 的包体发布)。
|
|
6
6
|
|
|
@@ -25,6 +25,7 @@ pnpm demo:dev
|
|
|
25
25
|
| 🪲 萤火虫 | `firefly` | 温暖的萤火虫光效 |
|
|
26
26
|
| 🔷 几何 | `geometry` | 漂浮的抽象几何图形 |
|
|
27
27
|
| 🌊 粒子海洋 | `wave` | 3D 粒子波浪(Three.js) |
|
|
28
|
+
| 🌊 轻量波浪 | `wave2d` | 轻量级粒子波浪(Canvas 2D) |
|
|
28
29
|
| 🚫 无 | `none` | 关闭粒子效果 |
|
|
29
30
|
|
|
30
31
|
## 安装
|
|
@@ -35,12 +36,14 @@ npm install @xdy-npm/react-particle-backgrounds
|
|
|
35
36
|
pnpm add @xdy-npm/react-particle-backgrounds
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
如需使用 **3D 粒子海洋**(`wave`)主题,还需要安装 Three.js:
|
|
39
40
|
|
|
40
41
|
```bash
|
|
41
42
|
npm install three
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
**轻量波浪**(`wave2d`)主题使用 Canvas 2D,无需额外依赖。
|
|
46
|
+
|
|
44
47
|
## 快速开始
|
|
45
48
|
|
|
46
49
|
### 基础用法(Props 方式)
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,19 @@ export declare const particleThemes: ParticleTheme[];
|
|
|
99
99
|
*/
|
|
100
100
|
export declare const ParticleWave: default_2.FC<ParticleWaveProps>;
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* 使用 Canvas 2D 渲染的粒子海洋波浪效果。
|
|
104
|
+
* 轻量级实现,无需 Three.js 依赖。
|
|
105
|
+
*/
|
|
106
|
+
export declare const ParticleWave2D: default_2.FC<ParticleWave2DProps>;
|
|
107
|
+
|
|
108
|
+
declare interface ParticleWave2DProps {
|
|
109
|
+
/** 波浪背后的 CSS 渐变或纯色背景 */
|
|
110
|
+
background?: string;
|
|
111
|
+
className?: string;
|
|
112
|
+
style?: default_2.CSSProperties;
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
declare interface ParticleWaveProps {
|
|
103
116
|
/** 波浪背后的 CSS 渐变或纯色背景 */
|
|
104
117
|
background?: string;
|
|
@@ -112,7 +125,7 @@ export declare const starlineTheme: ParticleTheme;
|
|
|
112
125
|
|
|
113
126
|
export declare const starsTheme: ParticleTheme;
|
|
114
127
|
|
|
115
|
-
export declare type ThemeId = 'starline' | 'snow' | 'bubble' | 'stars' | 'firefly' | 'geometry' | 'wave' | 'none';
|
|
128
|
+
export declare type ThemeId = 'starline' | 'snow' | 'bubble' | 'stars' | 'firefly' | 'geometry' | 'wave' | 'wave2d' | 'none';
|
|
116
129
|
|
|
117
130
|
/**
|
|
118
131
|
* 浮动主题选择器按钮 + 抽屉面板。
|
|
@@ -137,6 +150,8 @@ export declare interface ThemeSelectorProps {
|
|
|
137
150
|
/** 访问当前粒子主题上下文。必须在 `<ParticleProvider>` 内使用。 */
|
|
138
151
|
export declare const useParticleTheme: () => ParticleContextValue;
|
|
139
152
|
|
|
153
|
+
export declare const wave2dTheme: ParticleTheme;
|
|
154
|
+
|
|
140
155
|
export declare const waveTheme: ParticleTheme;
|
|
141
156
|
|
|
142
157
|
export { }
|