@votax572002/fluxfx 0.1.4 → 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 +101 -0
- package/dist/fluxfx.min.js +688 -49
- package/dist/index.cjs +688 -49
- package/dist/index.d.cts +130 -1
- package/dist/index.d.ts +130 -1
- package/dist/index.js +688 -49
- package/dist/react.cjs +688 -49
- package/dist/react.d.cts +296 -4
- package/dist/react.d.ts +296 -4
- package/dist/react.js +688 -49
- package/package.json +48 -48
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,14 @@ type ProtectionLabel = 'normal' | 'reduced-res' | 'low-fps' | 'survival';
|
|
|
4
4
|
type QualityLevel = 'low' | 'medium' | 'high';
|
|
5
5
|
type ThemeMode = 'auto' | 'light' | 'dark';
|
|
6
6
|
type LayerMode = 'background' | 'overlay';
|
|
7
|
+
type PrismShape = 'prism' | 'torus' | 'orb';
|
|
8
|
+
type DeviceTarget = 'all' | 'desktop' | 'mobile' | 'tablet';
|
|
9
|
+
type ImageFitMode = 'cover' | 'contain';
|
|
10
|
+
type ImagePosition = 'center' | 'top' | 'bottom';
|
|
11
|
+
type MotionScrubTrigger = 'cursor' | 'scroll' | 'both';
|
|
12
|
+
type MotionScrubAxis = 'x' | 'y' | 'xy';
|
|
13
|
+
type MotionScrubMode = 'auto' | 'atlas' | 'video' | 'sprite';
|
|
14
|
+
type MotionScrubTrackTarget = 'window' | 'element';
|
|
7
15
|
type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | Float32Array;
|
|
8
16
|
interface PerformanceOptions {
|
|
9
17
|
/** Enable adaptive DPR scaling when FPS drops (default: true) */
|
|
@@ -20,6 +28,18 @@ interface PerformanceOptions {
|
|
|
20
28
|
respectReducedMotion?: boolean;
|
|
21
29
|
/** Track container scroll progress (uScroll) and velocity (uScrollVel) (default: false) */
|
|
22
30
|
trackScroll?: boolean;
|
|
31
|
+
/** Target specific device class: 'all' | 'desktop' | 'mobile' | 'tablet' (default: 'all') */
|
|
32
|
+
device?: DeviceTarget;
|
|
33
|
+
/** Minimum viewport width in px required to mount/run the effect */
|
|
34
|
+
minWidth?: number;
|
|
35
|
+
/** Maximum viewport width in px allowed to mount/run the effect */
|
|
36
|
+
maxWidth?: number;
|
|
37
|
+
/** Shortcut: disable effect cleanly on mobile viewports (< mobileBreakpoint) */
|
|
38
|
+
disableOnMobile?: boolean;
|
|
39
|
+
/** Shortcut: disable effect cleanly on desktop viewports (>= mobileBreakpoint) */
|
|
40
|
+
disableOnDesktop?: boolean;
|
|
41
|
+
/** Viewport breakpoint in px separating mobile vs desktop (default: 768) */
|
|
42
|
+
mobileBreakpoint?: number;
|
|
23
43
|
}
|
|
24
44
|
interface FXInstance {
|
|
25
45
|
readonly isWebGL?: boolean;
|
|
@@ -61,6 +81,91 @@ interface FXOptions extends PerformanceOptions {
|
|
|
61
81
|
perspective?: number;
|
|
62
82
|
glare?: boolean;
|
|
63
83
|
strength?: number;
|
|
84
|
+
shape?: PrismShape;
|
|
85
|
+
depth?: number;
|
|
86
|
+
gloss?: number;
|
|
87
|
+
distortion?: number;
|
|
88
|
+
baseImage?: string;
|
|
89
|
+
revealImage?: string;
|
|
90
|
+
image?: string;
|
|
91
|
+
fit?: ImageFitMode;
|
|
92
|
+
position?: ImagePosition;
|
|
93
|
+
softness?: number;
|
|
94
|
+
edgeNoise?: number;
|
|
95
|
+
edgeGlow?: number;
|
|
96
|
+
ambient?: boolean;
|
|
97
|
+
clickReveal?: boolean;
|
|
98
|
+
activeIndex?: number;
|
|
99
|
+
focused?: boolean;
|
|
100
|
+
wrap?: boolean;
|
|
101
|
+
spread?: number;
|
|
102
|
+
depthScale?: number;
|
|
103
|
+
curve?: number;
|
|
104
|
+
parallax?: boolean | number;
|
|
105
|
+
focusOffsetX?: number;
|
|
106
|
+
focusScale?: number;
|
|
107
|
+
spotRadius?: number;
|
|
108
|
+
spotIntensity?: number;
|
|
109
|
+
spotPosition?: [number, number] | 'center' | 'left' | 'right';
|
|
110
|
+
onChange?: (detail: {
|
|
111
|
+
index: number;
|
|
112
|
+
focused: boolean;
|
|
113
|
+
total?: number;
|
|
114
|
+
element: HTMLElement | null;
|
|
115
|
+
}) => void;
|
|
116
|
+
videoSrc?: string;
|
|
117
|
+
src?: string;
|
|
118
|
+
spriteSrc?: string;
|
|
119
|
+
frames?: string | string[];
|
|
120
|
+
poster?: string;
|
|
121
|
+
cols?: number;
|
|
122
|
+
rows?: number;
|
|
123
|
+
frameCount?: number;
|
|
124
|
+
mode?: MotionScrubMode;
|
|
125
|
+
trigger?: MotionScrubTrigger;
|
|
126
|
+
axis?: MotionScrubAxis;
|
|
127
|
+
trackTarget?: MotionScrubTrackTarget;
|
|
128
|
+
sensitivity?: number;
|
|
129
|
+
damping?: number;
|
|
130
|
+
idlePosition?: number;
|
|
131
|
+
idleTimeout?: number;
|
|
132
|
+
returnToIdle?: boolean;
|
|
133
|
+
invert?: boolean;
|
|
134
|
+
clamp?: boolean;
|
|
135
|
+
startOffset?: number;
|
|
136
|
+
endOffset?: number;
|
|
137
|
+
chromaKey?: string;
|
|
138
|
+
chromaTolerance?: number;
|
|
139
|
+
chromaSoftness?: number;
|
|
140
|
+
crossfade?: boolean;
|
|
141
|
+
targetFps?: number;
|
|
142
|
+
tileInset?: number;
|
|
143
|
+
maxCacheWidth?: number;
|
|
144
|
+
blendMode?: string;
|
|
145
|
+
onProgress?: (detail: {
|
|
146
|
+
progress: number;
|
|
147
|
+
frame: number;
|
|
148
|
+
totalFrames: number;
|
|
149
|
+
ready: boolean;
|
|
150
|
+
mode: string;
|
|
151
|
+
}) => void;
|
|
152
|
+
pathSelector?: string;
|
|
153
|
+
startOffsetPx?: number;
|
|
154
|
+
endOffsetPx?: number;
|
|
155
|
+
offsetTop?: number;
|
|
156
|
+
offsetBottom?: number;
|
|
157
|
+
once?: boolean;
|
|
158
|
+
onWaypoint?: (detail: {
|
|
159
|
+
element: HTMLElement;
|
|
160
|
+
index: number;
|
|
161
|
+
progress: number;
|
|
162
|
+
}) => void;
|
|
163
|
+
cardSelector?: string;
|
|
164
|
+
tabSelector?: string;
|
|
165
|
+
stickyTop?: number;
|
|
166
|
+
offsetStep?: number;
|
|
167
|
+
scaleStep?: number;
|
|
168
|
+
opacityStep?: number;
|
|
64
169
|
[key: string]: unknown;
|
|
65
170
|
}
|
|
66
171
|
|
|
@@ -88,6 +193,15 @@ declare class FluxEngine {
|
|
|
88
193
|
private visibilityCallbacks;
|
|
89
194
|
private removeTicker;
|
|
90
195
|
private removeVisibilitySub;
|
|
196
|
+
private hasResizeListener;
|
|
197
|
+
private resizeRaf;
|
|
198
|
+
private isDeviceAllowed;
|
|
199
|
+
private hasDeviceConstraints;
|
|
200
|
+
private mountEntryInstance;
|
|
201
|
+
private unmountEntryInstance;
|
|
202
|
+
private attachEntryObserver;
|
|
203
|
+
private handleViewportResize;
|
|
204
|
+
private syncResizeWatcher;
|
|
91
205
|
private ensureObserver;
|
|
92
206
|
private ensureVisibilitySub;
|
|
93
207
|
private hasActiveTickWork;
|
|
@@ -138,6 +252,7 @@ interface WebGLQuadOptions extends PerformanceOptions {
|
|
|
138
252
|
adaptToSurface?: boolean;
|
|
139
253
|
overlayOpacity?: number;
|
|
140
254
|
uniforms?: Record<string, UniformValue>;
|
|
255
|
+
textures?: Record<string, string>;
|
|
141
256
|
interactive?: boolean;
|
|
142
257
|
}
|
|
143
258
|
declare class WebGLQuad {
|
|
@@ -200,6 +315,12 @@ declare class WebGLQuad {
|
|
|
200
315
|
private feedbackMaxDim;
|
|
201
316
|
private feedbackFloat;
|
|
202
317
|
private customUniforms;
|
|
318
|
+
private textureUrls;
|
|
319
|
+
private textureUnits;
|
|
320
|
+
private loadedImages;
|
|
321
|
+
private mainTextures;
|
|
322
|
+
private textureLoadTokens;
|
|
323
|
+
private nextTextureUnit;
|
|
203
324
|
private mouse;
|
|
204
325
|
private targetMouse;
|
|
205
326
|
private mouseVel;
|
|
@@ -336,6 +457,13 @@ declare class WebGLQuad {
|
|
|
336
457
|
pause(): void;
|
|
337
458
|
resume(): void;
|
|
338
459
|
destroy(): void;
|
|
460
|
+
private resolveTextureUrl;
|
|
461
|
+
private destroyMainTextures;
|
|
462
|
+
private bindMainTextures;
|
|
463
|
+
private uploadImageTexture;
|
|
464
|
+
private reuploadLoadedTextures;
|
|
465
|
+
private clearTextureSlot;
|
|
466
|
+
private syncTexturesFromOptions;
|
|
339
467
|
}
|
|
340
468
|
|
|
341
469
|
interface WebGLEffectConfig {
|
|
@@ -346,9 +474,10 @@ interface WebGLEffectConfig {
|
|
|
346
474
|
feedbackFloat?: boolean;
|
|
347
475
|
defaultColors: [string, string, string];
|
|
348
476
|
resolveUniforms?: (options: FXOptions) => Record<string, UniformValue>;
|
|
477
|
+
resolveTextures?: (options: FXOptions) => Record<string, string>;
|
|
349
478
|
}
|
|
350
479
|
declare function createWebGLEffect(config: WebGLEffectConfig): FXPlugin;
|
|
351
480
|
|
|
352
481
|
declare const FluxFX: FluxEngine;
|
|
353
482
|
|
|
354
|
-
export { type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type LayerMode, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
|
483
|
+
export { type DeviceTarget, type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type ImageFitMode, type ImagePosition, type LayerMode, type MotionScrubAxis, type MotionScrubMode, type MotionScrubTrackTarget, type MotionScrubTrigger, type PrismShape, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,14 @@ type ProtectionLabel = 'normal' | 'reduced-res' | 'low-fps' | 'survival';
|
|
|
4
4
|
type QualityLevel = 'low' | 'medium' | 'high';
|
|
5
5
|
type ThemeMode = 'auto' | 'light' | 'dark';
|
|
6
6
|
type LayerMode = 'background' | 'overlay';
|
|
7
|
+
type PrismShape = 'prism' | 'torus' | 'orb';
|
|
8
|
+
type DeviceTarget = 'all' | 'desktop' | 'mobile' | 'tablet';
|
|
9
|
+
type ImageFitMode = 'cover' | 'contain';
|
|
10
|
+
type ImagePosition = 'center' | 'top' | 'bottom';
|
|
11
|
+
type MotionScrubTrigger = 'cursor' | 'scroll' | 'both';
|
|
12
|
+
type MotionScrubAxis = 'x' | 'y' | 'xy';
|
|
13
|
+
type MotionScrubMode = 'auto' | 'atlas' | 'video' | 'sprite';
|
|
14
|
+
type MotionScrubTrackTarget = 'window' | 'element';
|
|
7
15
|
type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | Float32Array;
|
|
8
16
|
interface PerformanceOptions {
|
|
9
17
|
/** Enable adaptive DPR scaling when FPS drops (default: true) */
|
|
@@ -20,6 +28,18 @@ interface PerformanceOptions {
|
|
|
20
28
|
respectReducedMotion?: boolean;
|
|
21
29
|
/** Track container scroll progress (uScroll) and velocity (uScrollVel) (default: false) */
|
|
22
30
|
trackScroll?: boolean;
|
|
31
|
+
/** Target specific device class: 'all' | 'desktop' | 'mobile' | 'tablet' (default: 'all') */
|
|
32
|
+
device?: DeviceTarget;
|
|
33
|
+
/** Minimum viewport width in px required to mount/run the effect */
|
|
34
|
+
minWidth?: number;
|
|
35
|
+
/** Maximum viewport width in px allowed to mount/run the effect */
|
|
36
|
+
maxWidth?: number;
|
|
37
|
+
/** Shortcut: disable effect cleanly on mobile viewports (< mobileBreakpoint) */
|
|
38
|
+
disableOnMobile?: boolean;
|
|
39
|
+
/** Shortcut: disable effect cleanly on desktop viewports (>= mobileBreakpoint) */
|
|
40
|
+
disableOnDesktop?: boolean;
|
|
41
|
+
/** Viewport breakpoint in px separating mobile vs desktop (default: 768) */
|
|
42
|
+
mobileBreakpoint?: number;
|
|
23
43
|
}
|
|
24
44
|
interface FXInstance {
|
|
25
45
|
readonly isWebGL?: boolean;
|
|
@@ -61,6 +81,91 @@ interface FXOptions extends PerformanceOptions {
|
|
|
61
81
|
perspective?: number;
|
|
62
82
|
glare?: boolean;
|
|
63
83
|
strength?: number;
|
|
84
|
+
shape?: PrismShape;
|
|
85
|
+
depth?: number;
|
|
86
|
+
gloss?: number;
|
|
87
|
+
distortion?: number;
|
|
88
|
+
baseImage?: string;
|
|
89
|
+
revealImage?: string;
|
|
90
|
+
image?: string;
|
|
91
|
+
fit?: ImageFitMode;
|
|
92
|
+
position?: ImagePosition;
|
|
93
|
+
softness?: number;
|
|
94
|
+
edgeNoise?: number;
|
|
95
|
+
edgeGlow?: number;
|
|
96
|
+
ambient?: boolean;
|
|
97
|
+
clickReveal?: boolean;
|
|
98
|
+
activeIndex?: number;
|
|
99
|
+
focused?: boolean;
|
|
100
|
+
wrap?: boolean;
|
|
101
|
+
spread?: number;
|
|
102
|
+
depthScale?: number;
|
|
103
|
+
curve?: number;
|
|
104
|
+
parallax?: boolean | number;
|
|
105
|
+
focusOffsetX?: number;
|
|
106
|
+
focusScale?: number;
|
|
107
|
+
spotRadius?: number;
|
|
108
|
+
spotIntensity?: number;
|
|
109
|
+
spotPosition?: [number, number] | 'center' | 'left' | 'right';
|
|
110
|
+
onChange?: (detail: {
|
|
111
|
+
index: number;
|
|
112
|
+
focused: boolean;
|
|
113
|
+
total?: number;
|
|
114
|
+
element: HTMLElement | null;
|
|
115
|
+
}) => void;
|
|
116
|
+
videoSrc?: string;
|
|
117
|
+
src?: string;
|
|
118
|
+
spriteSrc?: string;
|
|
119
|
+
frames?: string | string[];
|
|
120
|
+
poster?: string;
|
|
121
|
+
cols?: number;
|
|
122
|
+
rows?: number;
|
|
123
|
+
frameCount?: number;
|
|
124
|
+
mode?: MotionScrubMode;
|
|
125
|
+
trigger?: MotionScrubTrigger;
|
|
126
|
+
axis?: MotionScrubAxis;
|
|
127
|
+
trackTarget?: MotionScrubTrackTarget;
|
|
128
|
+
sensitivity?: number;
|
|
129
|
+
damping?: number;
|
|
130
|
+
idlePosition?: number;
|
|
131
|
+
idleTimeout?: number;
|
|
132
|
+
returnToIdle?: boolean;
|
|
133
|
+
invert?: boolean;
|
|
134
|
+
clamp?: boolean;
|
|
135
|
+
startOffset?: number;
|
|
136
|
+
endOffset?: number;
|
|
137
|
+
chromaKey?: string;
|
|
138
|
+
chromaTolerance?: number;
|
|
139
|
+
chromaSoftness?: number;
|
|
140
|
+
crossfade?: boolean;
|
|
141
|
+
targetFps?: number;
|
|
142
|
+
tileInset?: number;
|
|
143
|
+
maxCacheWidth?: number;
|
|
144
|
+
blendMode?: string;
|
|
145
|
+
onProgress?: (detail: {
|
|
146
|
+
progress: number;
|
|
147
|
+
frame: number;
|
|
148
|
+
totalFrames: number;
|
|
149
|
+
ready: boolean;
|
|
150
|
+
mode: string;
|
|
151
|
+
}) => void;
|
|
152
|
+
pathSelector?: string;
|
|
153
|
+
startOffsetPx?: number;
|
|
154
|
+
endOffsetPx?: number;
|
|
155
|
+
offsetTop?: number;
|
|
156
|
+
offsetBottom?: number;
|
|
157
|
+
once?: boolean;
|
|
158
|
+
onWaypoint?: (detail: {
|
|
159
|
+
element: HTMLElement;
|
|
160
|
+
index: number;
|
|
161
|
+
progress: number;
|
|
162
|
+
}) => void;
|
|
163
|
+
cardSelector?: string;
|
|
164
|
+
tabSelector?: string;
|
|
165
|
+
stickyTop?: number;
|
|
166
|
+
offsetStep?: number;
|
|
167
|
+
scaleStep?: number;
|
|
168
|
+
opacityStep?: number;
|
|
64
169
|
[key: string]: unknown;
|
|
65
170
|
}
|
|
66
171
|
|
|
@@ -88,6 +193,15 @@ declare class FluxEngine {
|
|
|
88
193
|
private visibilityCallbacks;
|
|
89
194
|
private removeTicker;
|
|
90
195
|
private removeVisibilitySub;
|
|
196
|
+
private hasResizeListener;
|
|
197
|
+
private resizeRaf;
|
|
198
|
+
private isDeviceAllowed;
|
|
199
|
+
private hasDeviceConstraints;
|
|
200
|
+
private mountEntryInstance;
|
|
201
|
+
private unmountEntryInstance;
|
|
202
|
+
private attachEntryObserver;
|
|
203
|
+
private handleViewportResize;
|
|
204
|
+
private syncResizeWatcher;
|
|
91
205
|
private ensureObserver;
|
|
92
206
|
private ensureVisibilitySub;
|
|
93
207
|
private hasActiveTickWork;
|
|
@@ -138,6 +252,7 @@ interface WebGLQuadOptions extends PerformanceOptions {
|
|
|
138
252
|
adaptToSurface?: boolean;
|
|
139
253
|
overlayOpacity?: number;
|
|
140
254
|
uniforms?: Record<string, UniformValue>;
|
|
255
|
+
textures?: Record<string, string>;
|
|
141
256
|
interactive?: boolean;
|
|
142
257
|
}
|
|
143
258
|
declare class WebGLQuad {
|
|
@@ -200,6 +315,12 @@ declare class WebGLQuad {
|
|
|
200
315
|
private feedbackMaxDim;
|
|
201
316
|
private feedbackFloat;
|
|
202
317
|
private customUniforms;
|
|
318
|
+
private textureUrls;
|
|
319
|
+
private textureUnits;
|
|
320
|
+
private loadedImages;
|
|
321
|
+
private mainTextures;
|
|
322
|
+
private textureLoadTokens;
|
|
323
|
+
private nextTextureUnit;
|
|
203
324
|
private mouse;
|
|
204
325
|
private targetMouse;
|
|
205
326
|
private mouseVel;
|
|
@@ -336,6 +457,13 @@ declare class WebGLQuad {
|
|
|
336
457
|
pause(): void;
|
|
337
458
|
resume(): void;
|
|
338
459
|
destroy(): void;
|
|
460
|
+
private resolveTextureUrl;
|
|
461
|
+
private destroyMainTextures;
|
|
462
|
+
private bindMainTextures;
|
|
463
|
+
private uploadImageTexture;
|
|
464
|
+
private reuploadLoadedTextures;
|
|
465
|
+
private clearTextureSlot;
|
|
466
|
+
private syncTexturesFromOptions;
|
|
339
467
|
}
|
|
340
468
|
|
|
341
469
|
interface WebGLEffectConfig {
|
|
@@ -346,9 +474,10 @@ interface WebGLEffectConfig {
|
|
|
346
474
|
feedbackFloat?: boolean;
|
|
347
475
|
defaultColors: [string, string, string];
|
|
348
476
|
resolveUniforms?: (options: FXOptions) => Record<string, UniformValue>;
|
|
477
|
+
resolveTextures?: (options: FXOptions) => Record<string, string>;
|
|
349
478
|
}
|
|
350
479
|
declare function createWebGLEffect(config: WebGLEffectConfig): FXPlugin;
|
|
351
480
|
|
|
352
481
|
declare const FluxFX: FluxEngine;
|
|
353
482
|
|
|
354
|
-
export { type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type LayerMode, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|
|
483
|
+
export { type DeviceTarget, type FXInstance, type FXOptions, type FXPlugin, FluxEngine, FluxFX, type FluxStats, type ImageFitMode, type ImagePosition, type LayerMode, type MotionScrubAxis, type MotionScrubMode, type MotionScrubTrackTarget, type MotionScrubTrigger, type PrismShape, type QualityLevel, type ThemeMode, type WebGLEffectConfig, WebGLQuad, createWebGLEffect };
|