r3f-vfx 0.0.0 → 0.0.1
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/dist/index.d.ts +133 -0
- package/dist/index.js +7760 -0
- package/package.json +50 -25
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
|
|
3
|
+
declare const Appearance: Readonly<{
|
|
4
|
+
DEFAULT: "default";
|
|
5
|
+
GRADIENT: "gradient";
|
|
6
|
+
CIRCULAR: "circular";
|
|
7
|
+
}>;
|
|
8
|
+
declare const Blending: Readonly<{
|
|
9
|
+
NORMAL: any;
|
|
10
|
+
ADDITIVE: any;
|
|
11
|
+
MULTIPLY: any;
|
|
12
|
+
SUBTRACTIVE: any;
|
|
13
|
+
}>;
|
|
14
|
+
declare const EmitterShape: Readonly<{
|
|
15
|
+
POINT: 0;
|
|
16
|
+
BOX: 1;
|
|
17
|
+
SPHERE: 2;
|
|
18
|
+
CONE: 3;
|
|
19
|
+
DISK: 4;
|
|
20
|
+
EDGE: 5;
|
|
21
|
+
}>;
|
|
22
|
+
declare const AttractorType: Readonly<{
|
|
23
|
+
POINT: 0;
|
|
24
|
+
VORTEX: 1;
|
|
25
|
+
}>;
|
|
26
|
+
declare const Easing: Readonly<{
|
|
27
|
+
LINEAR: 0;
|
|
28
|
+
EASE_IN: 1;
|
|
29
|
+
EASE_OUT: 2;
|
|
30
|
+
EASE_IN_OUT: 3;
|
|
31
|
+
}>;
|
|
32
|
+
declare const Lighting: Readonly<{
|
|
33
|
+
BASIC: "basic";
|
|
34
|
+
STANDARD: "standard";
|
|
35
|
+
PHYSICAL: "physical";
|
|
36
|
+
}>;
|
|
37
|
+
declare function bakeCurveToArray(curveData: any, resolution?: number): Float32Array<ArrayBuffer>;
|
|
38
|
+
declare function createCombinedCurveTexture(sizeCurve: any, opacityCurve: any, velocityCurve: any, rotationSpeedCurve: any): any;
|
|
39
|
+
declare const VFXParticles: any;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Higher-order hook for programmatic emitter control
|
|
43
|
+
*
|
|
44
|
+
* Usage:
|
|
45
|
+
* const { emit, burst, start, stop } = useVFXEmitter("sparks");
|
|
46
|
+
*
|
|
47
|
+
* // Emit at a position
|
|
48
|
+
* emit([1, 2, 3], 50);
|
|
49
|
+
*
|
|
50
|
+
* // Burst with overrides
|
|
51
|
+
* burst([0, 0, 0], 100, { colorStart: ["#ff0000"] });
|
|
52
|
+
*/
|
|
53
|
+
declare function useVFXEmitter(name: any): {
|
|
54
|
+
emit: any;
|
|
55
|
+
burst: any;
|
|
56
|
+
start: any;
|
|
57
|
+
stop: any;
|
|
58
|
+
clear: any;
|
|
59
|
+
isEmitting: any;
|
|
60
|
+
getUniforms: any;
|
|
61
|
+
getParticles: () => any;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* VFXEmitter - A reusable emitter component that links to a VFXParticles system
|
|
65
|
+
*
|
|
66
|
+
* Multiple VFXEmitters can share a single VFXParticles instance without adding
|
|
67
|
+
* supplementary draw calls. Each emitter just calls spawn() on the shared system.
|
|
68
|
+
*
|
|
69
|
+
* The emitter renders a <group> that inherits parent transforms automatically,
|
|
70
|
+
* so you can place it as a child of any object and it will follow.
|
|
71
|
+
*
|
|
72
|
+
* Usage:
|
|
73
|
+
*
|
|
74
|
+
* // First, set up a VFXParticles with a name
|
|
75
|
+
* <VFXParticles name="sparks" maxParticles={1000} autoStart={false} ... />
|
|
76
|
+
*
|
|
77
|
+
* // Place emitter as child - it automatically follows parent transforms!
|
|
78
|
+
* <group ref={playerRef}>
|
|
79
|
+
* <VFXEmitter
|
|
80
|
+
* name="sparks"
|
|
81
|
+
* position={[0, 1, 0]} // Local offset from parent
|
|
82
|
+
* emitCount={5}
|
|
83
|
+
* delay={0.1}
|
|
84
|
+
* />
|
|
85
|
+
* </group>
|
|
86
|
+
*
|
|
87
|
+
* // Use localDirection to emit relative to parent's rotation
|
|
88
|
+
* <VFXEmitter
|
|
89
|
+
* name="sparks"
|
|
90
|
+
* direction={[[0, 0], [0, 0], [-1, -1]]} // Emit backward in local space
|
|
91
|
+
* localDirection={true} // Direction is transformed by parent's rotation
|
|
92
|
+
* />
|
|
93
|
+
*
|
|
94
|
+
* @param {object} props
|
|
95
|
+
* @param {string} props.name - Name of the registered VFXParticles system
|
|
96
|
+
* @param {object} [props.particlesRef] - Direct ref to VFXParticles (alternative to name)
|
|
97
|
+
* @param {[number, number, number]} [props.position=[0,0,0]] - Local position offset
|
|
98
|
+
* @param {number} [props.emitCount=10] - Particles to emit per burst
|
|
99
|
+
* @param {number} [props.delay=0] - Seconds between emissions (0 = every frame)
|
|
100
|
+
* @param {boolean} [props.autoStart=true] - Start emitting automatically
|
|
101
|
+
* @param {boolean} [props.loop=true] - Keep emitting (false = emit once)
|
|
102
|
+
* @param {boolean} [props.localDirection=false] - Transform direction by parent's world rotation
|
|
103
|
+
* @param {array} [props.direction] - Direction override [[minX,maxX],[minY,maxY],[minZ,maxZ]]
|
|
104
|
+
* @param {object} [props.overrides] - Per-spawn overrides (size, speed, colors, etc.)
|
|
105
|
+
* @param {function} [props.onEmit] - Callback fired after each emission
|
|
106
|
+
*/
|
|
107
|
+
declare const VFXEmitter: any;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* VFX Store - Centralized management for VFX particle systems
|
|
111
|
+
*
|
|
112
|
+
* Allows multiple VFXEmitter components to share a single VFXParticles instance,
|
|
113
|
+
* avoiding extra draw calls while enabling emission from multiple positions.
|
|
114
|
+
*
|
|
115
|
+
* Usage:
|
|
116
|
+
*
|
|
117
|
+
* // Register a particle system
|
|
118
|
+
* <VFXParticles ref={(ref) => registerParticles("sparks", ref)} ... />
|
|
119
|
+
*
|
|
120
|
+
* // Or use the VFXParticles name prop with auto-registration
|
|
121
|
+
* <VFXParticles name="sparks" ... />
|
|
122
|
+
*
|
|
123
|
+
* // Emit from anywhere using VFXEmitter (no extra draw calls!)
|
|
124
|
+
* <VFXEmitter name="sparks" position={[1, 0, 0]} emitCount={10} />
|
|
125
|
+
* <VFXEmitter name="sparks" position={[-1, 0, 0]} emitCount={5} />
|
|
126
|
+
*
|
|
127
|
+
* // Or emit programmatically
|
|
128
|
+
* const emit = useVFXStore(s => s.emit);
|
|
129
|
+
* emit("sparks", { x: 0, y: 1, z: 0, count: 20 });
|
|
130
|
+
*/
|
|
131
|
+
declare const useVFXStore: zustand.UseBoundStore<zustand.StoreApi<any>>;
|
|
132
|
+
|
|
133
|
+
export { Appearance, AttractorType, Blending, Easing, EmitterShape, Lighting, VFXEmitter, VFXParticles, bakeCurveToArray, createCombinedCurveTexture, useVFXEmitter, useVFXStore };
|