canvasparticles-js 3.6.6 → 3.6.7
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 +13 -13
- package/canvasParticles.js +1 -1
- package/canvasParticles.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -339,7 +339,7 @@ const options = {
|
|
|
339
339
|
|
|
340
340
|
### Update options on the fly
|
|
341
341
|
|
|
342
|
-
**Note:** The new option values are not validated, except for the options with a setter. Assigning invalid values will lead to unexpected behavior
|
|
342
|
+
**Note:** The new option values are not validated, except for the options with a setter. Assigning invalid values will lead to unexpected behavior.
|
|
343
343
|
|
|
344
344
|
#### Using the setter
|
|
345
345
|
|
|
@@ -350,12 +350,12 @@ These options require dedicated setters to ensure proper integration.
|
|
|
350
350
|
- options.particles.color
|
|
351
351
|
|
|
352
352
|
```js
|
|
353
|
-
const
|
|
353
|
+
const instance = new CanvasParticles(selector, options)
|
|
354
354
|
|
|
355
355
|
// Use the setters to update these specific options
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
instance.setBackground('red')
|
|
357
|
+
instance.setMouseConnectDistMult(0.8)
|
|
358
|
+
instance.setParticleColor('hsl(149, 100%, 50%)')
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
#### Changing the particle count
|
|
@@ -366,12 +366,12 @@ After updating the following options, the number of particles is not automatical
|
|
|
366
366
|
- options.particles.max
|
|
367
367
|
|
|
368
368
|
```js
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
instance.options.particles.ppm = 100
|
|
370
|
+
instance.options.particles.max = 300
|
|
371
371
|
|
|
372
372
|
// Apply the changes using one of these methods:
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
instance.newParticles() // Remove all particles and create the correct amount of new ones
|
|
374
|
+
instance.matchParticleCount() // Add or remove some particles to match the count
|
|
375
375
|
```
|
|
376
376
|
|
|
377
377
|
#### Modifying object properties
|
|
@@ -379,9 +379,9 @@ particles.matchParticleCount() // Add or remove some particles to match the coun
|
|
|
379
379
|
**All** other options can be updated by modifying the `options` object properties, with changes taking immediate effect.
|
|
380
380
|
|
|
381
381
|
```js
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
instance.options.mouse.interactionType = 0
|
|
383
|
+
instance.options.particles.connectDist = 200
|
|
384
|
+
instance.options.gravity.repulsive = 1
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
#### Updating options object
|
|
@@ -390,7 +390,7 @@ To update all options for the same class, pass a new options object.
|
|
|
390
390
|
|
|
391
391
|
```js
|
|
392
392
|
const options = { ... }
|
|
393
|
-
|
|
393
|
+
instance.setOptions(options)
|
|
394
394
|
```
|
|
395
395
|
|
|
396
396
|
## One pager example
|
package/canvasParticles.js
CHANGED
package/canvasParticles.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvasparticles-js",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.7",
|
|
4
4
|
"description": "In an HTML canvas, a bunch of interactive particles connected with lines when they approach each other.",
|
|
5
5
|
"main": "canvasParticles.js",
|
|
6
6
|
"module": "canvasParticles.mjs",
|