@jayf0x/fluidity-js 0.1.5 → 0.1.6

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 CHANGED
@@ -6,7 +6,17 @@
6
6
  [![license](https://img.shields.io/npm/l/@jayf0x/fluidity-js)](./LICENSE)
7
7
  [![size](https://img.shields.io/bundlephobia/minzip/@jayf0x/fluidity-js)](https://bundlephobia.com/package/@jayf0x/fluidity-js)
8
8
 
9
- [**Live demo →**](https://jayf0x.github.io/fluidity)
9
+ <a href="https://jayf0x.github.io/fluidity">
10
+ <p align="center" title='Try if you can make this effect.'>
11
+ <img align="center" src="assets/preview.png" alt="preview" height="300px"/>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <strong>
16
+ Live demo →
17
+ </strong>
18
+ </p>
19
+ </a>
10
20
 
11
21
  ---
12
22
 
package/dist/globals.d.ts CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  type FluidAlgorithm = 'standard' | 'glass' | 'ink' | 'aurora' | 'ripple';
4
4
 
5
+ /**
6
+ * Granular performance/quality controls. Both axes are independent — you can
7
+ * run a sharp display at a coarser simulation, or vice versa.
8
+ * Reactive: changes after mount are applied on the next animation frame.
9
+ */
10
+ interface FluidQuality {
11
+ /** devicePixelRatio multiplier for canvas backing resolution. Range [0.1, 1]. Default 1 (native). On Retina, 0.5 → 1× pixels (75% less fill). */
12
+ dpr?: number;
13
+ /** Simulation FBO size as a fraction of canvas size. Range [0.1, 1]. Default 0.5 (current behavior). Higher = more fluid detail, more GPU. */
14
+ sim?: number;
15
+ }
16
+
5
17
  interface FluidConfig {
6
18
  densityDissipation: number;
7
19
  velocityDissipation: number;
@@ -22,8 +34,8 @@ type PresetKey = 'calm' | 'sand' | 'wave' | 'neon' | 'smoke';
22
34
 
23
35
  interface FluidHandle {
24
36
  reset(): void;
25
- move(opts: { x: number; y: number; strength?: number }): void;
26
- splat(x: number, y: number, vx: number, vy: number, strength?: number): void;
37
+ move(x: number, y: number, strength?: number): void;
38
+ splat(x: number, y: number, velocityX: number, velocityY: number, strength?: number): void;
27
39
  updateConfig(config: Partial<FluidConfig>): void;
28
40
  }
29
41
 
@@ -33,6 +45,7 @@ interface FluidBaseProps {
33
45
  config?: Partial<FluidConfig>;
34
46
  isMouseEnabled?: boolean;
35
47
  isWorkerEnabled?: boolean;
48
+ quality?: FluidQuality;
36
49
  preset?: PresetKey;
37
50
  algorithm?: FluidAlgorithm;
38
51
  backgroundColor?: string;