particle-network-bg 0.0.4 → 0.1.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 +121 -0
- package/dist/chunk-A6P5SQOV.mjs +965 -0
- package/dist/index.d.mts +110 -1
- package/dist/index.d.ts +110 -1
- package/dist/index.js +558 -17
- package/dist/index.mjs +1 -1
- package/dist/react.js +558 -17
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-35XTC6S6.mjs +0 -424
package/README.md
CHANGED
|
@@ -126,6 +126,124 @@ function App() {
|
|
|
126
126
|
| `gradientOrbitRadius` | number | 0.3 | **Radial:** Orbit radius for center movement (0–1) |
|
|
127
127
|
| `gradientDithering` | boolean | true | *(Deprecated)* No longer used with CSS gradients |
|
|
128
128
|
| `gradientSmoothStops` | number | 4 | *(Deprecated)* No longer used with CSS gradients |
|
|
129
|
+
| `particleAssets` | array | — | Use icons/images as particles (see Asset Particles) |
|
|
130
|
+
| `assets` | object | — | Map of asset keys to URLs or SVG strings (required with `particleAssets`) |
|
|
131
|
+
| `assetColor` | string | — | Tint color for asset particles (hex). Omit to use original image colors |
|
|
132
|
+
| `assetOpacity` | number | 1 | Opacity for asset particles (0–1) |
|
|
133
|
+
| `mouseAttractPercentage` | number | — | % of particles that follow the mouse (0–100). Others repel |
|
|
134
|
+
| `mouseAttractAssets` | string[] | — | Asset keys whose particles follow the mouse. Others repel |
|
|
135
|
+
| `minParticleDistance` | number | — | Min distance (px). Particles repel when closer |
|
|
136
|
+
| `minParticleForce` | number | 0.5 | Strength of particle repulsion (0–2) |
|
|
137
|
+
| `connectionRules` | object | — | Control which categories connect (see Connection Rules) |
|
|
138
|
+
| `liquidGlass` | object | — | Liquid glass styling (see Liquid Glass) |
|
|
139
|
+
| `liquidGlassPercentage` | number | — | % of particles that render as liquid glass (0–100) |
|
|
140
|
+
| `liquidGlassCount` | number | — | Exact count of liquid glass particles |
|
|
141
|
+
| `particleTypes` | array | — | Mix circle, asset, liquidGlass (see Particle Types) |
|
|
142
|
+
|
|
143
|
+
## Liquid Glass
|
|
144
|
+
|
|
145
|
+
3D fluid spheres with blur + contrast for a gooey liquid feel. Each particle is rendered as a 3D sphere with shading, highlights, and blur. Overlapping blobs merge visually via the contrast filter.
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
new ParticleNetwork(canvas, {
|
|
149
|
+
liquidGlassPercentage: 40,
|
|
150
|
+
liquidGlass: {
|
|
151
|
+
blur: 12, // blur radius (px) for fluid gooey effect
|
|
152
|
+
contrast: 25, // container contrast for gooey merge
|
|
153
|
+
color: "#88ccff",
|
|
154
|
+
opacity: 0.6,
|
|
155
|
+
reflectionStrength: 0.85,
|
|
156
|
+
highlightPosition: "top-left",
|
|
157
|
+
highlightColor: "#ffffff",
|
|
158
|
+
shadowStrength: 0.4,
|
|
159
|
+
secondaryReflection: 0.25,
|
|
160
|
+
secondaryHighlightPosition: "bottom-right",
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Particle Types
|
|
166
|
+
|
|
167
|
+
Use `particleTypes` to mix circle, asset, and liquid glass particles with full control:
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
new ParticleNetwork(canvas, {
|
|
171
|
+
particleTypes: [
|
|
172
|
+
{ type: "circle", percentage: 50 },
|
|
173
|
+
{ type: "liquidGlass", percentage: 30 },
|
|
174
|
+
{ type: "asset", asset: "star", count: 20, liquidGlass: true },
|
|
175
|
+
],
|
|
176
|
+
assets: { star: "https://..." },
|
|
177
|
+
liquidGlass: { mergeDistance: 40, color: "#88ccff", ... },
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- **`circle`**: Normal circles
|
|
182
|
+
- **`liquidGlass`**: Liquid glass blobs (merge when close)
|
|
183
|
+
- **`asset`**: Icons/images; use `liquidGlass: true` to combine with glass
|
|
184
|
+
|
|
185
|
+
## Connection Rules
|
|
186
|
+
|
|
187
|
+
Control which particle categories can connect to each other. Categories: `"default"` (normal circles) and asset keys (e.g. `"star"`, `"fa_solid_heart"`).
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
new ParticleNetwork(canvas, {
|
|
191
|
+
particleAssets: [
|
|
192
|
+
{ asset: "star", count: 20 },
|
|
193
|
+
{ asset: "heart", count: 20 },
|
|
194
|
+
],
|
|
195
|
+
assets: { star: "...", heart: "..." },
|
|
196
|
+
connectionRules: {
|
|
197
|
+
allow: [["default", "star"], ["star", "heart"]], // only these pairs connect
|
|
198
|
+
deny: [["star", "heart"]], // or: all connect except these
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
- **`allow`**: Only these category pairs connect. Omit or empty = all connect.
|
|
204
|
+
- **`deny`**: These pairs never connect (applied after allow).
|
|
205
|
+
|
|
206
|
+
## Asset Particles
|
|
207
|
+
|
|
208
|
+
Use custom icons or images (SVG, PNG, etc.) as particles:
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
new ParticleNetwork(canvas, {
|
|
212
|
+
particleCount: 100,
|
|
213
|
+
particleAssets: [
|
|
214
|
+
{ asset: "star", count: 10 }, // exactly 10 particles with star icon
|
|
215
|
+
{ asset: "heart", percentage: 30 }, // 30% of particles with heart icon
|
|
216
|
+
],
|
|
217
|
+
assets: {
|
|
218
|
+
star: "https://example.com/star.svg",
|
|
219
|
+
heart: "<svg>...</svg>", // inline SVG string also supported
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Each entry in `particleAssets` must specify exactly one of `count` (exact number) or `percentage` (0–100). Remaining particles render as default circles.
|
|
225
|
+
|
|
226
|
+
## Mouse Attract
|
|
227
|
+
|
|
228
|
+
Control which particles follow vs repel the mouse. Use one or both:
|
|
229
|
+
|
|
230
|
+
```js
|
|
231
|
+
new ParticleNetwork(canvas, {
|
|
232
|
+
mouseAttractPercentage: 30, // 30% of particles follow the mouse
|
|
233
|
+
mouseAttractAssets: ["fa_solid_star"], // particles with this asset follow
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Particle Repulsion
|
|
238
|
+
|
|
239
|
+
Keep particles from overlapping. When two particles are closer than `minParticleDistance`, they repel each other:
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
new ParticleNetwork(canvas, {
|
|
243
|
+
minParticleDistance: 20,
|
|
244
|
+
minParticleForce: 0.5,
|
|
245
|
+
});
|
|
246
|
+
```
|
|
129
247
|
|
|
130
248
|
## Gradient Examples
|
|
131
249
|
|
|
@@ -193,6 +311,9 @@ import type {
|
|
|
193
311
|
ParticleNetworkConfig,
|
|
194
312
|
Particle,
|
|
195
313
|
GradientType,
|
|
314
|
+
ConnectionRules,
|
|
315
|
+
LiquidGlassConfig,
|
|
316
|
+
ParticleTypeEntry,
|
|
196
317
|
} from "particle-network-bg";
|
|
197
318
|
```
|
|
198
319
|
|