@elementalfx/fluid 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +101 -2
- package/dist/chunks/chunk-BJGWRE4G.js +775 -0
- package/dist/chunks/chunk-BJGWRE4G.js.map +7 -0
- package/dist/element.d.ts +77 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +40 -0
- package/dist/element.js.map +7 -0
- package/dist/fluid.d.ts +31 -0
- package/dist/fluid.d.ts.map +1 -0
- package/dist/fluid.global.js +120 -0
- package/dist/global.d.ts +3 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +7 -0
- package/dist/options.d.ts +62 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/shaders.d.ts +24 -0
- package/dist/shaders.d.ts.map +1 -0
- package/package.json +71 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/options.ts", "../../src/fluid.ts", "../../src/shaders.ts"],
|
|
4
|
+
"sourcesContent": ["export type FluidPreset = 'smoke' | 'ink' | 'neon';\nexport type FluidMode = 'cursor' | 'background';\nexport type FluidQuality = 'auto' | 'low' | 'medium' | 'high';\n\nexport interface FluidOptions {\n /** Starting values for every option below. Default 'ink'. */\n preset?: FluidPreset;\n /**\n * 'cursor': a transparent overlay over the whole page that follows the pointer.\n * 'background': fills the element behind its content. Defaults to 'cursor'\n * on `document.body` and 'background' on any other element.\n */\n mode?: FluidMode;\n /** Dye colors as CSS hex strings, or 'rainbow' for random hues. */\n colors?: string[] | 'rainbow';\n /** Brightness of injected dye. Default 0.15. */\n brightness?: number;\n /** How fast dye fades, per second. Default 1. */\n dyeDissipation?: number;\n /** How fast motion fades, per second. Default 0.2. */\n velocityDissipation?: number;\n /** Fraction of pressure kept between frames, 0 to 1. Default 0.8. */\n pressure?: number;\n /** Swirl strength (vorticity confinement). Default 30. */\n curl?: number;\n /** Splat size, as a fraction of the area. Default 0.25. */\n splatRadius?: number;\n /** How hard pointer movement pushes the fluid. Default 6000. */\n splatForce?: number;\n /** Invisible strokes that keep a background flowing on its own. Default 0 (cursor) or 1 (background). */\n ambient?: number;\n /** Soft 3D shading from dye density, 0 to 1. Default 1. */\n shading?: number;\n /** Maximum opacity of the overlay, 0 to 1. Default 1. */\n opacity?: number;\n /** Simulation detail. 'auto' starts by device and steps down if frames run slow. Default 'auto'. */\n quality?: FluidQuality;\n /** Pointer movement stirs the fluid. Default true. */\n interactive?: boolean;\n /** CSS z-index of the cursor overlay. Default 2147483000. */\n zIndex?: number;\n /** Skip the effect when the user prefers reduced motion. Default true. */\n respectReducedMotion?: boolean;\n /** Stop animating while scrolled out of view. Default true. */\n pauseOffscreen?: boolean;\n /** Upper bound for devicePixelRatio. Default 2. */\n maxPixelRatio?: number;\n}\n\nexport type ResolvedFluidOptions = Required<Omit<FluidOptions, 'mode' | 'ambient'>> & {\n mode: FluidMode | null;\n ambient: number | null;\n colors: string[] | 'rainbow';\n};\n\nconst base: Omit<ResolvedFluidOptions, 'preset'> = {\n mode: null,\n colors: 'rainbow',\n brightness: 0.2,\n dyeDissipation: 1,\n velocityDissipation: 0.2,\n pressure: 0.8,\n curl: 30,\n splatRadius: 0.25,\n splatForce: 6000,\n ambient: null,\n shading: 1,\n opacity: 1,\n quality: 'auto',\n interactive: true,\n zIndex: 2147483000,\n respectReducedMotion: true,\n pauseOffscreen: true,\n maxPixelRatio: 2,\n};\n\nexport const presets: Record<FluidPreset, Partial<FluidOptions>> = {\n ink: {},\n smoke: {\n colors: ['#ffffff'],\n brightness: 0.09,\n dyeDissipation: 1.4,\n velocityDissipation: 0.5,\n curl: 18,\n splatRadius: 0.18,\n shading: 0.6,\n },\n neon: {\n colors: ['#18e7ff', '#ff2bd6', '#7dff5a', '#ffd400', '#8a5cff'],\n brightness: 0.22,\n dyeDissipation: 1.1,\n curl: 45,\n shading: 0.3,\n },\n};\n\nexport interface QualityTier {\n name: 'low' | 'medium' | 'high';\n sim: number;\n dye: number;\n iterations: number;\n}\n\nexport const tiers: QualityTier[] = [\n { name: 'low', sim: 64, dye: 256, iterations: 10 },\n { name: 'medium', sim: 96, dye: 512, iterations: 16 },\n { name: 'high', sim: 128, dye: 1024, iterations: 20 },\n];\n\nexport function resolveOptions(options: FluidOptions): ResolvedFluidOptions {\n const preset = options.preset && presets[options.preset] ? options.preset : 'ink';\n const merged: Record<string, unknown> = { ...base, ...presets[preset] };\n for (const [key, value] of Object.entries(options)) if (value !== undefined) merged[key] = value;\n merged.preset = preset;\n return merged as ResolvedFluidOptions;\n}\n", "import { EffectRuntime, createRandom, isBrowser, noise3, pixelRatio, resolveElement } from '@elementalfx/core';\nimport {\n FULLSCREEN_VERTEX,\n PingPong,\n RenderTarget,\n createFullscreenDraw,\n createProgram,\n getWebGL2,\n isWebGL2Supported,\n simulationFormat,\n watchContextLoss,\n type Program,\n type TargetFormat,\n} from '@elementalfx/gl';\nimport { ADVECT, CURL, DISPLAY, DIVERGENCE, GRADIENT_SUBTRACT, PRESSURE, SCALE, SPLAT, VORTICITY } from './shaders';\nimport { resolveOptions, tiers, type FluidMode, type FluidOptions, type QualityTier, type ResolvedFluidOptions } from './options';\n\n/** A running fluid simulation. */\nexport interface Fluid {\n readonly element: HTMLElement;\n readonly options: Readonly<ResolvedFluidOptions>;\n /** 'cursor' or 'background'. */\n readonly mode: FluidMode;\n /** Resolves to true once drawing, false if the effect can't run here. */\n readonly ready: Promise<boolean>;\n /** Current quality tier. */\n readonly quality: 'low' | 'medium' | 'high';\n /**\n * Pushes the fluid at (x, y) CSS px from the area's top-left with velocity\n * (dx, dy) in CSS px, adding dye of `color` (hex) or the next palette color.\n */\n splat(x: number, y: number, dx: number, dy: number, color?: string): void;\n /** Fires `count` splats in random directions, around (x, y) if given. */\n burst(count?: number, at?: { x: number; y: number }): void;\n set(options: FluidOptions): void;\n /** Clears all dye and motion. */\n clear(): void;\n pause(): void;\n play(): void;\n destroy(): void;\n}\n\ninterface GLState {\n gl: WebGL2RenderingContext;\n format: TargetFormat;\n programs: Record<'advect' | 'divergence' | 'curl' | 'vorticity' | 'scale' | 'pressure' | 'gradient' | 'splat' | 'display', Program>;\n quad: { draw(): void; delete(): void };\n velocity: PingPong;\n dye: PingPong;\n pressure: PingPong;\n divergence: RenderTarget;\n curl: RenderTarget;\n simSize: [number, number];\n dyeSize: [number, number];\n}\n\n/** Adds an interactive fluid simulation: a cursor trail over the page or a living background. */\nexport function createFluid(target: HTMLElement | string = 'body', options: FluidOptions = {}): Fluid {\n let element = isBrowser ? resolveElement(target) : (target as HTMLElement);\n if (isBrowser && element === document.documentElement) element = document.body;\n return new FluidEffect(element, options);\n}\n\nclass FluidEffect implements Fluid {\n readonly element: HTMLElement;\n readonly ready: Promise<boolean>;\n options: ResolvedFluidOptions;\n\n private userOptions: FluidOptions;\n private resolveReady!: (ok: boolean) => void;\n private settled = false;\n private runtime: EffectRuntime | null = null;\n private canvas: HTMLCanvasElement | null = null;\n private state: GLState | null = null;\n private mounted = false;\n private destroyed = false;\n private cleanups: Array<() => void> = [];\n private restoreStyles: Array<() => void> = [];\n private random = createRandom(Math.floor(Math.random() * 2 ** 31));\n private tierIndex = 2;\n private width = 1;\n private height = 1;\n private idleTime = 0;\n private clock = 0;\n private wanderers: Array<{ x: number; y: number; heading: number; seed: number; color: [number, number, number]; colorAge: number }> = [];\n private frameTimes: number[] = [];\n private qualityCooldown = 3;\n private pointers = new Map<number, { x: number; y: number; color: [number, number, number]; colorAge: number }>();\n private resizeQueued = false;\n\n constructor(element: HTMLElement, options: FluidOptions) {\n this.element = element;\n this.userOptions = { ...options };\n this.options = resolveOptions(this.userOptions);\n this.ready = new Promise((resolve) => (this.resolveReady = resolve));\n if (!isBrowser || !isWebGL2Supported()) {\n this.settle(false);\n return;\n }\n this.tierIndex = this.initialTier();\n this.runtime = new EffectRuntime({\n element,\n frame: (dt) => this.frame(dt),\n pauseOffscreen: this.options.pauseOffscreen,\n respectReducedMotion: this.options.respectReducedMotion,\n onReducedMotionChange: (reduce) => (reduce ? this.unmount() : this.mount()),\n });\n if (this.runtime.reducedMotion) this.settle(false);\n else this.mount();\n }\n\n get mode(): FluidMode {\n return this.options.mode ?? (isBrowser && this.element === document.body ? 'cursor' : 'background');\n }\n\n get quality(): 'low' | 'medium' | 'high' {\n return tiers[this.tierIndex]!.name;\n }\n\n private get ambient(): number {\n return this.options.ambient ?? (this.mode === 'background' ? 1 : 0);\n }\n\n // ---------------------------------------------------------------- public API\n\n splat(x: number, y: number, dx: number, dy: number, color?: string): void {\n this.splatScaled(x, y, dx, dy, color ? hexToRgb(color) : this.nextColor(), 1, 1);\n }\n\n private splatScaled(x: number, y: number, dx: number, dy: number, rgb: [number, number, number], dyeScale: number, radiusScale: number): void {\n const state = this.state;\n if (!state) return;\n const scale = this.options.brightness * dyeScale;\n this.applySplat(state, x / this.width, 1 - y / this.height, dx / this.width, -dy / this.height, [rgb[0] * scale, rgb[1] * scale, rgb[2] * scale], radiusScale);\n this.idleTime = 0;\n this.runtime?.wake();\n }\n\n burst(count = 6, at?: { x: number; y: number }): void {\n for (let i = 0; i < count; i++) {\n const x = at ? at.x + (this.random() - 0.5) * 40 : this.random() * this.width;\n const y = at ? at.y + (this.random() - 0.5) * 40 : this.random() * this.height;\n const angle = this.random() * Math.PI * 2;\n const speed = (0.6 + this.random() * 0.8) * Math.min(this.width, this.height) * 0.35;\n this.splat(x, y, Math.cos(angle) * speed, Math.sin(angle) * speed);\n }\n }\n\n set(options: FluidOptions): void {\n if (this.destroyed) return;\n const previous = this.options;\n this.userOptions = { ...this.userOptions, ...options };\n this.options = resolveOptions(this.userOptions);\n if (previous.respectReducedMotion !== this.options.respectReducedMotion) {\n this.runtime?.setRespectReducedMotion(this.options.respectReducedMotion);\n }\n if (previous.quality !== this.options.quality) {\n this.tierIndex = this.initialTier();\n if (this.state) this.allocate(this.state);\n }\n const remount =\n previous.mode !== this.options.mode || previous.zIndex !== this.options.zIndex || previous.maxPixelRatio !== this.options.maxPixelRatio;\n if (remount && this.mounted) {\n this.unmount();\n this.mount();\n return;\n }\n if (previous.interactive !== this.options.interactive) this.bindPointer();\n this.idleTime = 0;\n this.runtime?.wake();\n }\n\n clear(): void {\n if (!this.state) return;\n this.state.velocity.clear();\n this.state.dye.clear();\n this.state.pressure.clear();\n this.display();\n }\n\n pause(): void {\n this.runtime?.pause();\n }\n\n play(): void {\n this.idleTime = 0;\n this.runtime?.play();\n this.runtime?.wake();\n }\n\n destroy(): void {\n if (this.destroyed) return;\n this.unmount();\n this.destroyed = true;\n this.runtime?.destroy();\n this.runtime = null;\n this.settle(false);\n }\n\n // ------------------------------------------------------------- mount/unmount\n\n private mount(): void {\n if (this.mounted || this.destroyed || this.runtime?.reducedMotion) return;\n const canvas = document.createElement('canvas');\n canvas.setAttribute('aria-hidden', 'true');\n canvas.dataset.fx = 'fluid';\n const s = canvas.style;\n s.left = '0';\n s.top = '0';\n s.width = '100%';\n s.height = '100%';\n s.display = 'block';\n s.pointerEvents = 'none';\n if (this.mode === 'cursor') {\n s.position = 'fixed';\n s.zIndex = String(this.options.zIndex);\n document.body.append(canvas);\n } else {\n const computed = getComputedStyle(this.element);\n if (computed.position === 'static') this.stash('position', 'relative');\n if (computed.zIndex === 'auto') this.stash('z-index', '0');\n s.position = 'absolute';\n s.zIndex = '-1';\n s.borderRadius = computed.borderRadius;\n this.element.prepend(canvas);\n }\n this.canvas = canvas;\n this.state = this.createGL();\n if (!this.state) {\n canvas.remove();\n this.canvas = null;\n for (const restore of this.restoreStyles.splice(0).reverse()) restore();\n this.settle(false);\n return;\n }\n this.mounted = true;\n this.cleanups.push(\n watchContextLoss(\n canvas,\n () => {\n this.state = null;\n },\n () => {\n this.state = this.createGL();\n this.runtime?.wake();\n },\n ),\n );\n const resize = (): void => {\n this.resizeQueued = true;\n this.runtime?.wake();\n };\n const observer = new ResizeObserver(resize);\n observer.observe(this.mode === 'cursor' ? document.documentElement : this.element);\n window.addEventListener('resize', resize);\n this.cleanups.push(() => {\n observer.disconnect();\n window.removeEventListener('resize', resize);\n });\n this.bindPointer();\n this.measure();\n if (this.mode === 'background') this.burst(5);\n this.display();\n this.idleTime = 0;\n this.runtime?.wake();\n this.settle(true);\n }\n\n private unmount(): void {\n if (!this.mounted) return;\n this.mounted = false;\n for (const cleanup of this.cleanups.splice(0)) cleanup();\n this.releaseGL();\n this.canvas?.remove();\n this.canvas = null;\n this.pointers.clear();\n for (const restore of this.restoreStyles.splice(0).reverse()) restore();\n }\n\n private stash(property: string, value: string): void {\n const element = this.element;\n const previous = element.style.getPropertyValue(property);\n element.style.setProperty(property, value);\n this.restoreStyles.push(() => {\n if (previous) element.style.setProperty(property, previous);\n else element.style.removeProperty(property);\n });\n }\n\n private measure(): void {\n if (!this.canvas || !this.state) return;\n const rect = this.canvas.getBoundingClientRect();\n this.width = Math.max(1, rect.width);\n this.height = Math.max(1, rect.height);\n const dpr = pixelRatio(this.options.maxPixelRatio);\n this.canvas.width = Math.max(1, Math.round(this.width * dpr));\n this.canvas.height = Math.max(1, Math.round(this.height * dpr));\n this.allocate(this.state);\n this.resizeQueued = false;\n }\n\n // ------------------------------------------------------------------- WebGL\n\n private createGL(): GLState | null {\n const canvas = this.canvas;\n if (!canvas) return null;\n const gl = getWebGL2(canvas, { powerPreference: 'low-power' });\n if (!gl) return null;\n try {\n const format = simulationFormat(gl, { precision: 'half' });\n if (format.packed) {\n console.warn('[elementalfx] fluid: this GPU cannot render to float textures, so the fluid is off.');\n gl.getExtension('WEBGL_lose_context')?.loseContext();\n return null;\n }\n const make = (source: string): Program => createProgram(gl, FULLSCREEN_VERTEX, source);\n const programs = {\n advect: make(ADVECT),\n divergence: make(DIVERGENCE),\n curl: make(CURL),\n vorticity: make(VORTICITY),\n scale: make(SCALE),\n pressure: make(PRESSURE),\n gradient: make(GRADIENT_SUBTRACT),\n splat: make(SPLAT),\n display: make(DISPLAY),\n };\n const state = {\n gl,\n format,\n programs,\n quad: createFullscreenDraw(gl),\n simSize: [0, 0],\n dyeSize: [0, 0],\n } as unknown as GLState;\n this.allocate(state);\n return state;\n } catch (error) {\n console.warn('[elementalfx] fluid: WebGL setup failed.', error);\n gl.getExtension('WEBGL_lose_context')?.loseContext();\n return null;\n }\n }\n\n /** (Re)creates simulation textures for the current size and quality tier. */\n private allocate(state: GLState): void {\n const tier = tiers[this.tierIndex]!;\n const sim = gridSize(tier.sim, this.width, this.height);\n const dye = gridSize(tier.dye, this.width, this.height);\n const { gl, format } = state;\n if (state.simSize[0] !== sim[0] || state.simSize[1] !== sim[1]) {\n state.velocity?.delete();\n state.pressure?.delete();\n state.divergence?.delete();\n state.curl?.delete();\n state.velocity = new PingPong(gl, sim[0], sim[1], format);\n state.pressure = new PingPong(gl, sim[0], sim[1], format);\n state.divergence = new RenderTarget(gl, sim[0], sim[1], format);\n state.curl = new RenderTarget(gl, sim[0], sim[1], format);\n state.simSize = sim;\n }\n if (state.dyeSize[0] !== dye[0] || state.dyeSize[1] !== dye[1]) {\n state.dye?.delete();\n state.dye = new PingPong(gl, dye[0], dye[1], format);\n state.dyeSize = dye;\n }\n }\n\n private releaseGL(): void {\n const state = this.state;\n this.state = null;\n if (!state) return;\n const { gl } = state;\n if (!gl.isContextLost()) {\n for (const program of Object.values(state.programs)) program.delete();\n state.quad.delete();\n state.velocity.delete();\n state.dye.delete();\n state.pressure.delete();\n state.divergence.delete();\n state.curl.delete();\n }\n gl.getExtension('WEBGL_lose_context')?.loseContext();\n }\n\n /** Runs one pass: binds textures to units in order, sets uniforms, draws into `target`. */\n private pass(\n state: GLState,\n program: Program,\n target: RenderTarget | null,\n textures: Record<string, WebGLTexture>,\n uniforms: (u: Record<string, WebGLUniformLocation>) => void,\n ): void {\n const { gl } = state;\n program.use();\n let unit = 0;\n for (const [name, texture] of Object.entries(textures)) {\n gl.activeTexture(gl.TEXTURE0 + unit);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n const location = program.uniforms[name];\n if (location) gl.uniform1i(location, unit);\n unit++;\n }\n uniforms(program.uniforms);\n if (target) target.bind();\n else {\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n }\n state.quad.draw();\n }\n\n private applySplat(state: GLState, u: number, v: number, du: number, dv: number, color: [number, number, number], radiusScale = 1): void {\n const { gl } = state;\n gl.disable(gl.BLEND);\n const aspect = this.width / this.height;\n const radius = (this.options.splatRadius / 100) * (aspect > 1 ? aspect : 1) * radiusScale;\n const force = this.options.splatForce;\n const p = state.programs.splat;\n this.pass(state, p, state.velocity.write, { uTarget: state.velocity.read.texture }, (uni) => {\n gl.uniform1f(uni.uAspect!, aspect);\n gl.uniform2f(uni.uPoint!, u, v);\n gl.uniform3f(uni.uValue!, du * force, dv * force, 0);\n gl.uniform1f(uni.uRadius!, radius);\n });\n state.velocity.swap();\n this.pass(state, p, state.dye.write, { uTarget: state.dye.read.texture }, (uni) => {\n gl.uniform1f(uni.uAspect!, aspect);\n gl.uniform2f(uni.uPoint!, u, v);\n gl.uniform3f(uni.uValue!, color[0], color[1], color[2]);\n gl.uniform1f(uni.uRadius!, radius);\n });\n state.dye.swap();\n }\n\n private step(state: GLState, dt: number): void {\n const { gl, programs } = state;\n const tier = tiers[this.tierIndex]!;\n const simTexel: [number, number] = [1 / state.simSize[0], 1 / state.simSize[1]];\n const o = this.options;\n gl.disable(gl.BLEND);\n const texel = (u: Record<string, WebGLUniformLocation>, t: [number, number] = simTexel): void => {\n if (u.uTexel) gl.uniform2f(u.uTexel, t[0], t[1]);\n };\n\n this.pass(state, programs.curl, state.curl, { uVelocity: state.velocity.read.texture }, (u) => texel(u));\n this.pass(state, programs.vorticity, state.velocity.write, { uVelocity: state.velocity.read.texture, uCurl: state.curl.texture }, (u) => {\n texel(u);\n gl.uniform1f(u.uCurlStrength!, o.curl);\n gl.uniform1f(u.uDt!, dt);\n });\n state.velocity.swap();\n this.pass(state, programs.divergence, state.divergence, { uVelocity: state.velocity.read.texture }, (u) => texel(u));\n this.pass(state, programs.scale, state.pressure.write, { uSource: state.pressure.read.texture }, (u) => {\n texel(u);\n gl.uniform1f(u.uValue!, Math.max(0, Math.min(1, o.pressure)));\n });\n state.pressure.swap();\n for (let i = 0; i < tier.iterations; i++) {\n this.pass(state, programs.pressure, state.pressure.write, { uPressure: state.pressure.read.texture, uDivergence: state.divergence.texture }, (u) => texel(u));\n state.pressure.swap();\n }\n this.pass(state, programs.gradient, state.velocity.write, { uPressure: state.pressure.read.texture, uVelocity: state.velocity.read.texture }, (u) => texel(u));\n state.velocity.swap();\n this.pass(state, programs.advect, state.velocity.write, { uVelocity: state.velocity.read.texture, uSource: state.velocity.read.texture }, (u) => {\n texel(u);\n gl.uniform1f(u.uDt!, dt);\n gl.uniform1f(u.uDissipation!, o.velocityDissipation);\n });\n state.velocity.swap();\n this.pass(state, programs.advect, state.dye.write, { uVelocity: state.velocity.read.texture, uSource: state.dye.read.texture }, (u) => {\n texel(u);\n gl.uniform1f(u.uDt!, dt);\n gl.uniform1f(u.uDissipation!, o.dyeDissipation);\n });\n state.dye.swap();\n }\n\n private display(): void {\n const state = this.state;\n if (!state) return;\n const { gl } = state;\n gl.disable(gl.BLEND);\n this.pass(state, state.programs.display, null, { uDye: state.dye.read.texture }, (u) => {\n gl.uniform2f(u.uTexel!, 1 / state.dyeSize[0], 1 / state.dyeSize[1]);\n gl.uniform1f(u.uOpacity!, Math.max(0, Math.min(1, this.options.opacity)));\n gl.uniform1f(u.uShading!, Math.max(0, Math.min(1, this.options.shading)));\n });\n }\n\n // ------------------------------------------------------------------- frame\n\n private frame(dt: number): void {\n const state = this.state;\n if (!state || state.gl.isContextLost()) return;\n if (this.resizeQueued) this.measure();\n this.adaptQuality(dt);\n\n const ambient = this.ambient;\n this.updateWanderers(dt, Math.round(ambient));\n for (const pointer of this.pointers.values()) pointer.colorAge += dt;\n\n this.step(state, Math.min(dt, 1 / 30));\n this.display();\n\n this.idleTime += dt;\n const settleTime = Math.max(4, 7 / Math.max(0.1, this.options.dyeDissipation));\n if (ambient <= 0 && this.idleTime > settleTime) {\n this.clear();\n this.runtime?.sleep();\n }\n }\n\n /**\n * Invisible strokes that drift around the area like a slow cursor, so a\n * background keeps flowing without anyone touching it.\n */\n private updateWanderers(dt: number, count: number): void {\n while (this.wanderers.length < count) {\n this.wanderers.push({\n x: this.random() * this.width,\n y: this.random() * this.height,\n heading: this.random() * Math.PI * 2,\n seed: this.random() * 100,\n color: this.nextColor(),\n colorAge: 0,\n });\n }\n this.wanderers.length = Math.max(0, count);\n this.clock += dt;\n const speed = Math.min(this.width, this.height) * 0.55;\n for (const w of this.wanderers) {\n // Steer with smooth noise; turn back toward the middle near the edges.\n w.heading += noise3(this.clock * 0.35, w.seed, 0) * dt * 3.2;\n const margin = Math.min(this.width, this.height) * 0.22;\n const edge = Math.min(w.x, w.y, this.width - w.x, this.height - w.y);\n if (edge < margin) {\n const toCenter = Math.atan2(this.height / 2 - w.y, this.width / 2 - w.x);\n w.heading += Math.sin(toCenter - w.heading) * dt * 7 * (1 - edge / margin);\n }\n const dx = Math.cos(w.heading) * speed * dt;\n const dy = Math.sin(w.heading) * speed * dt;\n w.x += dx;\n w.y += dy;\n // Bounce off the bounds if steering wasn't enough.\n if (w.x < 0 || w.x > this.width) {\n w.heading = Math.PI - w.heading;\n w.x = Math.max(0, Math.min(this.width, w.x));\n }\n if (w.y < 0 || w.y > this.height) {\n w.heading = -w.heading;\n w.y = Math.max(0, Math.min(this.height, w.y));\n }\n w.colorAge += dt;\n if (w.colorAge > 2.5) {\n w.color = this.nextColor();\n w.colorAge = 0;\n }\n // Wandering strokes splat every frame, so they carry less dye than a pointer.\n this.splatScaled(w.x, w.y, dx, dy, w.color, 0.22, 0.45);\n }\n }\n\n /** In 'auto' quality, steps down a tier when frames stay slower than ~40 fps. */\n private adaptQuality(dt: number): void {\n if (this.options.quality !== 'auto' || this.tierIndex === 0) return;\n this.qualityCooldown -= dt;\n this.frameTimes.push(dt);\n if (this.frameTimes.length > 90) this.frameTimes.shift();\n if (this.qualityCooldown > 0 || this.frameTimes.length < 90) return;\n const average = this.frameTimes.reduce((sum, t) => sum + t, 0) / this.frameTimes.length;\n if (average > 1 / 40) {\n this.tierIndex--;\n this.frameTimes = [];\n this.qualityCooldown = 3;\n if (this.state) this.allocate(this.state);\n }\n }\n\n private initialTier(): number {\n const quality = this.options.quality;\n if (quality !== 'auto') return tiers.findIndex((tier: QualityTier) => tier.name === quality);\n const coarse = isBrowser && typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;\n return coarse ? 1 : 2;\n }\n\n // ------------------------------------------------------------------ input\n\n private pointerCleanup: (() => void) | null = null;\n\n private bindPointer(): void {\n this.pointerCleanup?.();\n this.pointerCleanup = null;\n if (!this.options.interactive || !this.mounted) return;\n const target: EventTarget = this.mode === 'cursor' ? window : this.element;\n const local = (event: PointerEvent): { x: number; y: number } => {\n const rect = this.canvas!.getBoundingClientRect();\n return { x: event.clientX - rect.left, y: event.clientY - rect.top };\n };\n const move = (event: Event): void => {\n const e = event as PointerEvent;\n const point = local(e);\n const pointer = this.pointers.get(e.pointerId);\n if (!pointer) {\n this.pointers.set(e.pointerId, { ...point, color: this.nextColor(), colorAge: 0 });\n return;\n }\n const dx = point.x - pointer.x;\n const dy = point.y - pointer.y;\n pointer.x = point.x;\n pointer.y = point.y;\n if (dx === 0 && dy === 0) return;\n if (pointer.colorAge > 0.6) {\n pointer.color = this.nextColor();\n pointer.colorAge = 0;\n }\n this.splatScaled(point.x, point.y, dx, dy, pointer.color, 1, 1);\n };\n const down = (event: Event): void => {\n const e = event as PointerEvent;\n const point = local(e);\n this.pointers.set(e.pointerId, { ...point, color: this.nextColor(), colorAge: 0 });\n this.burst(3, point);\n };\n const up = (event: Event): void => {\n const e = event as PointerEvent;\n if (e.pointerType !== 'mouse') this.pointers.delete(e.pointerId);\n };\n target.addEventListener('pointermove', move, { passive: true });\n target.addEventListener('pointerdown', down, { passive: true });\n target.addEventListener('pointerup', up, { passive: true });\n target.addEventListener('pointercancel', up, { passive: true });\n this.pointerCleanup = () => {\n target.removeEventListener('pointermove', move);\n target.removeEventListener('pointerdown', down);\n target.removeEventListener('pointerup', up);\n target.removeEventListener('pointercancel', up);\n };\n this.cleanups.push(() => {\n this.pointerCleanup?.();\n this.pointerCleanup = null;\n });\n }\n\n private nextColor(): [number, number, number] {\n const colors = this.options.colors;\n if (colors === 'rainbow' || colors.length === 0) return hsvToRgb(this.random(), 1, 1);\n return hexToRgb(colors[Math.floor(this.random() * colors.length)]!);\n }\n\n private settle(ok: boolean): void {\n if (this.settled) return;\n this.settled = true;\n this.resolveReady(ok);\n }\n}\n\n/** Grid size with `resolution` cells along the shorter side, matching the area's aspect. */\nfunction gridSize(resolution: number, width: number, height: number): [number, number] {\n const aspect = width / height;\n const short = Math.round(resolution);\n const long = Math.round(resolution * (aspect >= 1 ? aspect : 1 / aspect));\n return aspect >= 1 ? [long, short] : [short, long];\n}\n\nfunction hexToRgb(hex: string): [number, number, number] {\n let value = hex.trim().replace('#', '');\n if (value.length === 3) value = value.replace(/./g, (c) => c + c);\n const n = Number.parseInt(value, 16);\n if (value.length !== 6 || Number.isNaN(n)) return [1, 1, 1];\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n}\n\nfunction hsvToRgb(h: number, s: number, v: number): [number, number, number] {\n const i = Math.floor(h * 6);\n const f = h * 6 - i;\n const p = v * (1 - s);\n const q = v * (1 - f * s);\n const t = v * (1 - (1 - f) * s);\n switch (i % 6) {\n case 0: return [v, t, p];\n case 1: return [q, v, p];\n case 2: return [p, v, t];\n case 3: return [p, q, v];\n case 4: return [t, p, v];\n default: return [v, p, q];\n }\n}\n", "/**\n * Stable-fluids passes (Stam 1999; GPU Gems ch. 38). Velocity is stored in\n * simulation cells per second; walls reflect velocity at the edges.\n */\n\nconst HEADER = `#version 300 es\nprecision highp float;\nprecision highp sampler2D;\nin vec2 vUv;\nout vec4 outColor;\nuniform vec2 uTexel;\n`;\n\n/** Neighbour lookups shared by passes that need them. */\nconst NEIGHBOURS = `\nvec2 uvL() { return vUv - vec2(uTexel.x, 0.0); }\nvec2 uvR() { return vUv + vec2(uTexel.x, 0.0); }\nvec2 uvB() { return vUv - vec2(0.0, uTexel.y); }\nvec2 uvT() { return vUv + vec2(0.0, uTexel.y); }\n`;\n\n/** Moves a quantity along the velocity field (semi-Lagrangian) and fades it. */\nexport const ADVECT = `${HEADER}\nuniform sampler2D uVelocity;\nuniform sampler2D uSource;\nuniform float uDt;\nuniform float uDissipation;\nvoid main() {\n vec2 back = vUv - uDt * texture(uVelocity, vUv).xy * uTexel;\n outColor = texture(uSource, back) / (1.0 + uDissipation * uDt);\n}`;\n\nexport const DIVERGENCE = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uVelocity;\nvoid main() {\n vec2 c = texture(uVelocity, vUv).xy;\n float l = texture(uVelocity, uvL()).x;\n float r = texture(uVelocity, uvR()).x;\n float b = texture(uVelocity, uvB()).y;\n float t = texture(uVelocity, uvT()).y;\n // Solid walls: mirror the normal component at the boundary.\n if (uvL().x < 0.0) l = -c.x;\n if (uvR().x > 1.0) r = -c.x;\n if (uvB().y < 0.0) b = -c.y;\n if (uvT().y > 1.0) t = -c.y;\n outColor = vec4(0.5 * (r - l + t - b), 0.0, 0.0, 1.0);\n}`;\n\nexport const CURL = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uVelocity;\nvoid main() {\n float l = texture(uVelocity, uvL()).y;\n float r = texture(uVelocity, uvR()).y;\n float b = texture(uVelocity, uvB()).x;\n float t = texture(uVelocity, uvT()).x;\n outColor = vec4(0.5 * (r - l - t + b), 0.0, 0.0, 1.0);\n}`;\n\n/** Vorticity confinement: re-injects the small swirls that numerical diffusion smooths away. */\nexport const VORTICITY = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uVelocity;\nuniform sampler2D uCurl;\nuniform float uCurlStrength;\nuniform float uDt;\nvoid main() {\n float l = texture(uCurl, uvL()).x;\n float r = texture(uCurl, uvR()).x;\n float b = texture(uCurl, uvB()).x;\n float t = texture(uCurl, uvT()).x;\n float c = texture(uCurl, vUv).x;\n vec2 force = 0.5 * vec2(abs(t) - abs(b), abs(r) - abs(l));\n force /= length(force) + 1e-4;\n force *= uCurlStrength * c;\n force.y = -force.y;\n vec2 velocity = texture(uVelocity, vUv).xy + force * uDt;\n outColor = vec4(clamp(velocity, -1000.0, 1000.0), 0.0, 1.0);\n}`;\n\n/** Fades last frame's pressure; it's a good starting guess for this frame's solve. */\nexport const SCALE = `${HEADER}\nuniform sampler2D uSource;\nuniform float uValue;\nvoid main() {\n outColor = texture(uSource, vUv) * uValue;\n}`;\n\n/** One Jacobi iteration of the pressure Poisson equation. */\nexport const PRESSURE = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uPressure;\nuniform sampler2D uDivergence;\nvoid main() {\n float l = texture(uPressure, uvL()).x;\n float r = texture(uPressure, uvR()).x;\n float b = texture(uPressure, uvB()).x;\n float t = texture(uPressure, uvT()).x;\n float divergence = texture(uDivergence, vUv).x;\n outColor = vec4((l + r + b + t - divergence) * 0.25, 0.0, 0.0, 1.0);\n}`;\n\n/** Removes the pressure gradient, leaving a divergence-free (incompressible) velocity. */\nexport const GRADIENT_SUBTRACT = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uPressure;\nuniform sampler2D uVelocity;\nvoid main() {\n float l = texture(uPressure, uvL()).x;\n float r = texture(uPressure, uvR()).x;\n float b = texture(uPressure, uvB()).x;\n float t = texture(uPressure, uvT()).x;\n vec2 velocity = texture(uVelocity, vUv).xy - 0.5 * vec2(r - l, t - b);\n outColor = vec4(velocity, 0.0, 1.0);\n}`;\n\n/** Adds a Gaussian blob of velocity or dye. */\nexport const SPLAT = `${HEADER}\nuniform sampler2D uTarget;\nuniform float uAspect;\nuniform vec3 uValue;\nuniform vec2 uPoint;\nuniform float uRadius;\nvoid main() {\n vec2 p = vUv - uPoint;\n p.x *= uAspect;\n vec3 base = texture(uTarget, vUv).xyz;\n outColor = vec4(base + exp(-dot(p, p) / uRadius) * uValue, 1.0);\n}`;\n\n/**\n * Draws the dye with transparency where there's none, so the page shows\n * through. Optional shading reads dye density as a height for a soft 3D look.\n */\nexport const DISPLAY = `${HEADER}${NEIGHBOURS}\nuniform sampler2D uDye;\nuniform float uOpacity;\nuniform float uShading;\nvoid main() {\n vec3 color = texture(uDye, vUv).rgb;\n if (uShading > 0.0) {\n float dx = length(texture(uDye, uvR()).rgb) - length(texture(uDye, uvL()).rgb);\n float dy = length(texture(uDye, uvT()).rgb) - length(texture(uDye, uvB()).rgb);\n vec3 n = normalize(vec3(dx, dy, length(uTexel)));\n float diffuse = clamp(dot(n, vec3(0.0, 0.0, 1.0)) + 0.7, 0.7, 1.0);\n color *= mix(1.0, diffuse, uShading);\n }\n float alpha = clamp(max(color.r, max(color.g, color.b)), 0.0, 1.0) * uOpacity;\n // Premultiplied output: dye adds light where it's dense and fades to clear.\n outColor = vec4(min(color, vec3(1.0)) * uOpacity, alpha);\n}`;\n"],
|
|
5
|
+
"mappings": ";AAuDA,IAAM,OAA6C;AAAA,EACjD,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,sBAAsB;AAAA,EACtB,gBAAgB;AAAA,EAChB,eAAe;AACjB;AAEO,IAAM,UAAsD;AAAA,EACjE,KAAK,CAAC;AAAA,EACN,OAAO;AAAA,IACL,QAAQ,CAAC,SAAS;AAAA,IAClB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,qBAAqB;AAAA,IAC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KAAK,KAAM,OAAO,MAAO,KAAK,IAAK,OAAO,MAAM,IAAI,OAAO,GAAG;AAC1E;AAEA,SAAS,SAAS,GAAW,GAAW,GAAqC;AAC3E,QAAM,IAAI,KAAK,MAAM,IAAI,CAAC;AAC1B,QAAM,IAAI,IAAI,IAAI;AAClB,QAAM,IAAI,KAAK,IAAI;AACnB,QAAM,IAAI,KAAK,IAAI,IAAI;AACvB,QAAM,IAAI,KAAK,KAAK,IAAI,KAAK;AAC7B,UAAQ,IAAI,GAAG;AAAA,IACb,KAAK;AAAG,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,IACvB,KAAK;AAAG,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,IACvB,KAAK;AAAG,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,IACvB,KAAK;AAAG,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,IACvB,KAAK;AAAG,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,IACvB;AAAS,aAAO,CAAC,GAAG,GAAG,CAAC;AAAA,EAC1B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type EffectElement } from '@elementalfx/core';
|
|
2
|
+
import { type Fluid } from './fluid';
|
|
3
|
+
/** `<fx-fluid>`: a fluid background behind its content, or a page-wide cursor trail with `page`. */
|
|
4
|
+
export type FluidElement = EffectElement<Fluid>;
|
|
5
|
+
export declare const fluidAttributes: {
|
|
6
|
+
readonly preset: {
|
|
7
|
+
readonly option: "preset";
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
};
|
|
10
|
+
readonly mode: {
|
|
11
|
+
readonly option: "mode";
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
};
|
|
14
|
+
readonly colors: {
|
|
15
|
+
readonly option: "colors";
|
|
16
|
+
readonly type: "list";
|
|
17
|
+
};
|
|
18
|
+
readonly brightness: {
|
|
19
|
+
readonly option: "brightness";
|
|
20
|
+
readonly type: "number";
|
|
21
|
+
};
|
|
22
|
+
readonly 'dye-dissipation': {
|
|
23
|
+
readonly option: "dyeDissipation";
|
|
24
|
+
readonly type: "number";
|
|
25
|
+
};
|
|
26
|
+
readonly 'velocity-dissipation': {
|
|
27
|
+
readonly option: "velocityDissipation";
|
|
28
|
+
readonly type: "number";
|
|
29
|
+
};
|
|
30
|
+
readonly curl: {
|
|
31
|
+
readonly option: "curl";
|
|
32
|
+
readonly type: "number";
|
|
33
|
+
};
|
|
34
|
+
readonly 'splat-radius': {
|
|
35
|
+
readonly option: "splatRadius";
|
|
36
|
+
readonly type: "number";
|
|
37
|
+
};
|
|
38
|
+
readonly 'splat-force': {
|
|
39
|
+
readonly option: "splatForce";
|
|
40
|
+
readonly type: "number";
|
|
41
|
+
};
|
|
42
|
+
readonly ambient: {
|
|
43
|
+
readonly option: "ambient";
|
|
44
|
+
readonly type: "number";
|
|
45
|
+
};
|
|
46
|
+
readonly shading: {
|
|
47
|
+
readonly option: "shading";
|
|
48
|
+
readonly type: "number";
|
|
49
|
+
};
|
|
50
|
+
readonly opacity: {
|
|
51
|
+
readonly option: "opacity";
|
|
52
|
+
readonly type: "number";
|
|
53
|
+
};
|
|
54
|
+
readonly quality: {
|
|
55
|
+
readonly option: "quality";
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
};
|
|
58
|
+
readonly interactive: {
|
|
59
|
+
readonly option: "interactive";
|
|
60
|
+
readonly type: "boolean";
|
|
61
|
+
};
|
|
62
|
+
readonly page: {
|
|
63
|
+
readonly option: "page";
|
|
64
|
+
readonly type: "boolean";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Registers `<fx-fluid>` (or a custom tag name). Safe to call more than once
|
|
69
|
+
* and during server rendering, where it does nothing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function defineFluid(tagName?: string): CustomElementConstructor | undefined;
|
|
72
|
+
declare global {
|
|
73
|
+
interface HTMLElementTagNameMap {
|
|
74
|
+
'fx-fluid': FluidElement;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAGlD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBlB,CAAC;AAEX;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAa,GAAG,wBAAwB,GAAG,SAAS,CAUtF;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,YAAY,CAAC;KAC1B;CACF"}
|
package/dist/element.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFluid
|
|
3
|
+
} from "./chunks/chunk-BJGWRE4G.js";
|
|
4
|
+
|
|
5
|
+
// packages/fluid/src/element.ts
|
|
6
|
+
import { defineEffectElement } from "@elementalfx/core";
|
|
7
|
+
var fluidAttributes = {
|
|
8
|
+
preset: { option: "preset", type: "string" },
|
|
9
|
+
mode: { option: "mode", type: "string" },
|
|
10
|
+
colors: { option: "colors", type: "list" },
|
|
11
|
+
brightness: { option: "brightness", type: "number" },
|
|
12
|
+
"dye-dissipation": { option: "dyeDissipation", type: "number" },
|
|
13
|
+
"velocity-dissipation": { option: "velocityDissipation", type: "number" },
|
|
14
|
+
curl: { option: "curl", type: "number" },
|
|
15
|
+
"splat-radius": { option: "splatRadius", type: "number" },
|
|
16
|
+
"splat-force": { option: "splatForce", type: "number" },
|
|
17
|
+
ambient: { option: "ambient", type: "number" },
|
|
18
|
+
shading: { option: "shading", type: "number" },
|
|
19
|
+
opacity: { option: "opacity", type: "number" },
|
|
20
|
+
quality: { option: "quality", type: "string" },
|
|
21
|
+
interactive: { option: "interactive", type: "boolean" },
|
|
22
|
+
page: { option: "page", type: "boolean" }
|
|
23
|
+
};
|
|
24
|
+
function defineFluid(tagName = "fx-fluid") {
|
|
25
|
+
return defineEffectElement(tagName, {
|
|
26
|
+
attributes: { ...fluidAttributes },
|
|
27
|
+
hostStyle: { display: "block" },
|
|
28
|
+
create: (host, options) => {
|
|
29
|
+
const { page, colors, ...rest } = options;
|
|
30
|
+
const palette = colors && colors.length === 1 && colors[0] === "rainbow" ? "rainbow" : colors;
|
|
31
|
+
return createFluid(page ? document.body : host, { ...rest, ...palette ? { colors: palette } : {} });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
defineFluid();
|
|
36
|
+
export {
|
|
37
|
+
defineFluid,
|
|
38
|
+
fluidAttributes
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/element.ts"],
|
|
4
|
+
"sourcesContent": ["import { defineEffectElement, type EffectElement } from '@elementalfx/core';\nimport { createFluid, type Fluid } from './fluid';\nimport type { FluidOptions } from './options';\n\n/** `<fx-fluid>`: a fluid background behind its content, or a page-wide cursor trail with `page`. */\nexport type FluidElement = EffectElement<Fluid>;\n\nexport const fluidAttributes = {\n preset: { option: 'preset', type: 'string' },\n mode: { option: 'mode', type: 'string' },\n colors: { option: 'colors', type: 'list' },\n brightness: { option: 'brightness', type: 'number' },\n 'dye-dissipation': { option: 'dyeDissipation', type: 'number' },\n 'velocity-dissipation': { option: 'velocityDissipation', type: 'number' },\n curl: { option: 'curl', type: 'number' },\n 'splat-radius': { option: 'splatRadius', type: 'number' },\n 'splat-force': { option: 'splatForce', type: 'number' },\n ambient: { option: 'ambient', type: 'number' },\n shading: { option: 'shading', type: 'number' },\n opacity: { option: 'opacity', type: 'number' },\n quality: { option: 'quality', type: 'string' },\n interactive: { option: 'interactive', type: 'boolean' },\n page: { option: 'page', type: 'boolean' },\n} as const;\n\n/**\n * Registers `<fx-fluid>` (or a custom tag name). Safe to call more than once\n * and during server rendering, where it does nothing.\n */\nexport function defineFluid(tagName = 'fx-fluid'): CustomElementConstructor | undefined {\n return defineEffectElement(tagName, {\n attributes: { ...fluidAttributes },\n hostStyle: { display: 'block' },\n create: (host, options) => {\n const { page, colors, ...rest } = options as FluidOptions & { page?: boolean; colors?: string[] };\n const palette = colors && colors.length === 1 && colors[0] === 'rainbow' ? 'rainbow' : colors;\n return createFluid(page ? document.body : host, { ...rest, ...(palette ? { colors: palette } : {}) });\n },\n });\n}\n\ndefineFluid();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'fx-fluid': FluidElement;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,SAAS,2BAA+C;AAOjD,IAAM,kBAAkB;AAAA,EAC7B,QAAQ,EAAE,QAAQ,UAAU,MAAM,SAAS;AAAA,EAC3C,MAAM,EAAE,QAAQ,QAAQ,MAAM,SAAS;AAAA,EACvC,QAAQ,EAAE,QAAQ,UAAU,MAAM,OAAO;AAAA,EACzC,YAAY,EAAE,QAAQ,cAAc,MAAM,SAAS;AAAA,EACnD,mBAAmB,EAAE,QAAQ,kBAAkB,MAAM,SAAS;AAAA,EAC9D,wBAAwB,EAAE,QAAQ,uBAAuB,MAAM,SAAS;AAAA,EACxE,MAAM,EAAE,QAAQ,QAAQ,MAAM,SAAS;AAAA,EACvC,gBAAgB,EAAE,QAAQ,eAAe,MAAM,SAAS;AAAA,EACxD,eAAe,EAAE,QAAQ,cAAc,MAAM,SAAS;AAAA,EACtD,SAAS,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,EAC7C,SAAS,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,EAC7C,SAAS,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,EAC7C,SAAS,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,EAC7C,aAAa,EAAE,QAAQ,eAAe,MAAM,UAAU;AAAA,EACtD,MAAM,EAAE,QAAQ,QAAQ,MAAM,UAAU;AAC1C;AAMO,SAAS,YAAY,UAAU,YAAkD;AACtF,SAAO,oBAAoB,SAAS;AAAA,IAClC,YAAY,EAAE,GAAG,gBAAgB;AAAA,IACjC,WAAW,EAAE,SAAS,QAAQ;AAAA,IAC9B,QAAQ,CAAC,MAAM,YAAY;AACzB,YAAM,EAAE,MAAM,QAAQ,GAAG,KAAK,IAAI;AAClC,YAAM,UAAU,UAAU,OAAO,WAAW,KAAK,OAAO,CAAC,MAAM,YAAY,YAAY;AACvF,aAAO,YAAY,OAAO,SAAS,OAAO,MAAM,EAAE,GAAG,MAAM,GAAI,UAAU,EAAE,QAAQ,QAAQ,IAAI,CAAC,EAAG,CAAC;AAAA,IACtG;AAAA,EACF,CAAC;AACH;AAEA,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/fluid.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FluidMode, type FluidOptions, type ResolvedFluidOptions } from './options';
|
|
2
|
+
/** A running fluid simulation. */
|
|
3
|
+
export interface Fluid {
|
|
4
|
+
readonly element: HTMLElement;
|
|
5
|
+
readonly options: Readonly<ResolvedFluidOptions>;
|
|
6
|
+
/** 'cursor' or 'background'. */
|
|
7
|
+
readonly mode: FluidMode;
|
|
8
|
+
/** Resolves to true once drawing, false if the effect can't run here. */
|
|
9
|
+
readonly ready: Promise<boolean>;
|
|
10
|
+
/** Current quality tier. */
|
|
11
|
+
readonly quality: 'low' | 'medium' | 'high';
|
|
12
|
+
/**
|
|
13
|
+
* Pushes the fluid at (x, y) CSS px from the area's top-left with velocity
|
|
14
|
+
* (dx, dy) in CSS px, adding dye of `color` (hex) or the next palette color.
|
|
15
|
+
*/
|
|
16
|
+
splat(x: number, y: number, dx: number, dy: number, color?: string): void;
|
|
17
|
+
/** Fires `count` splats in random directions, around (x, y) if given. */
|
|
18
|
+
burst(count?: number, at?: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}): void;
|
|
22
|
+
set(options: FluidOptions): void;
|
|
23
|
+
/** Clears all dye and motion. */
|
|
24
|
+
clear(): void;
|
|
25
|
+
pause(): void;
|
|
26
|
+
play(): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Adds an interactive fluid simulation: a cursor trail over the page or a living background. */
|
|
30
|
+
export declare function createFluid(target?: HTMLElement | string, options?: FluidOptions): Fluid;
|
|
31
|
+
//# sourceMappingURL=fluid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluid.d.ts","sourceRoot":"","sources":["../src/fluid.ts"],"names":[],"mappings":"AAeA,OAAO,EAAyB,KAAK,SAAS,EAAE,KAAK,YAAY,EAAoB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAElI,kCAAkC;AAClC,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IACjD,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C;;;OAGG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1E,yEAAyE;IACzE,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACjC,iCAAiC;IACjC,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,IAAI,CAAC;CACjB;AAgBD,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,MAAM,GAAE,WAAW,GAAG,MAAe,EAAE,OAAO,GAAE,YAAiB,GAAG,KAAK,CAIpG"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*! @elementalfx/fluid v0.1.0 | MIT */
|
|
2
|
+
"use strict";var ElementalFX=ElementalFX||{};ElementalFX.fluid=(()=>{var S=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var xe=(t,e)=>{for(var i in e)S(t,i,{get:e[i],enumerable:!0})},Ee=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ye(e))!be.call(t,n)&&n!==i&&S(t,n,{get:()=>e[n],enumerable:!(r=ve(e,n))||r.enumerable});return t};var Te=t=>Ee(S({},"__esModule",{value:!0}),t);var Pe={};xe(Pe,{createFluid:()=>A,defineFluid:()=>I,presets:()=>P,resolveOptions:()=>M,tiers:()=>x});var f=typeof window<"u"&&typeof document<"u",W="(prefers-reduced-motion: reduce)";function N(){return f&&typeof window.matchMedia=="function"&&window.matchMedia(W).matches}function ge(t){if(!f||typeof window.matchMedia!="function")return()=>{};let e=window.matchMedia(W),i=()=>t(e.matches);return e.addEventListener("change",i),()=>e.removeEventListener("change",i)}function z(t=2){let e=f&&window.devicePixelRatio||1;return Math.max(1,Math.min(t,e))}function H(t){if(typeof t!="string")return t;let e=document.querySelector(t);if(!e)throw new Error(`[elementalfx] No element matches "${t}"`);return e}var E=new Set,b=0,R=0;function $(t){b=0;let e=R?Math.min((t-R)/1e3,.1):1/60;R=t;for(let i of Array.from(E))try{i(e,t)}catch(r){E.delete(i),console.error("[elementalfx] An effect threw during a frame and was stopped.",r)}E.size>0?b=requestAnimationFrame($):R=0}function Re(t){return E.add(t),b||(b=requestAnimationFrame($)),()=>{E.delete(t),E.size===0&&b&&(cancelAnimationFrame(b),b=0,R=0)}}var q=class{constructor(t){this.options=t,this.playing=!0,this.onscreen=!0,this.idle=!1,this.destroyed=!1,this.unsubscribe=null,this.observer=null,this.respectReduced=t.respectReducedMotion??!0,this.reduced=this.respectReduced&&N(),this.stopWatchingMotion=ge(e=>{let i=this.respectReduced&&e;i!==this.reduced&&(this.reduced=i,t.onReducedMotionChange?.(i),this.update())}),f&&(t.pauseOffscreen??!0)&&"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(e=>{let i=e[e.length-1];i&&(this.onscreen=i.isIntersecting,this.update())},{rootMargin:"64px"}),this.observer.observe(t.element)),this.update()}get reducedMotion(){return this.reduced}get running(){return this.unsubscribe!==null}get isPlaying(){return this.playing}setRespectReducedMotion(t){this.respectReduced=t;let e=t&&N();e!==this.reduced&&(this.reduced=e,this.options.onReducedMotionChange?.(e)),this.update()}play(){this.playing=!0,this.update()}pause(){this.playing=!1,this.update()}sleep(){this.idle=!0,this.update()}wake(){this.idle&&(this.idle=!1,this.update())}destroy(){this.destroyed=!0,this.observer?.disconnect(),this.observer=null,this.stopWatchingMotion(),this.update()}update(){let t=!this.destroyed&&this.playing&&this.onscreen&&!this.idle&&!this.reduced;t&&!this.unsubscribe?this.unsubscribe=Re(this.options.frame):!t&&this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)}};function V(t,e){switch(e){case"boolean":return t!==null&&t!=="false";case"number":{if(t===null||t.trim()==="")return;let i=Number(t);return Number.isFinite(i)?i:void 0}case"list":return t===null?void 0:t.split(/[\s,]+/).filter(Boolean);case"json":if(t===null)return;try{return JSON.parse(t)}catch{console.warn(`[elementalfx] Ignoring attribute value that is not valid JSON: ${t}`);return}default:return t??void 0}}function X(t,e,i){let r=e.split("."),n=t;for(let o of r.slice(0,-1)){let s=n[o];(typeof s!="object"||s===null)&&(n[o]={}),n=n[o]}n[r[r.length-1]]=i}function Q(t,e){if(!f||typeof customElements>"u")return;let i=customElements.get(t);if(i)return i;let r=Object.keys(e.attributes);class n extends HTMLElement{constructor(){super(...arguments),this.instance=null,this.pendingSetup=!1}static get observedAttributes(){return r}get effect(){return this.instance}connectedCallback(){for(let[s,c]of Object.entries(e.hostStyle??{})){let a=s;!this.style[a]&&getComputedStyle(this)[a]===we(a)&&(this.style[a]=c)}if(document.readyState==="loading"){if(this.pendingSetup)return;this.pendingSetup=!0,document.addEventListener("DOMContentLoaded",()=>this.setup(),{once:!0})}else this.setup()}disconnectedCallback(){this.instance?.destroy(),this.instance=null}attributeChangedCallback(s,c,a){if(!this.instance||c===a)return;let u=e.attributes[s];if(!u)return;let d={};X(d,u.option,V(a,u.type)),this.instance.set(d)}setup(){if(this.pendingSetup=!1,!this.isConnected||this.instance)return;let s={};for(let c of r){if(!this.hasAttribute(c))continue;let a=e.attributes[c],u=V(this.getAttribute(c),a.type);u!==void 0&&X(s,a.option,u)}this.instance=e.create(this,s),this.dispatchEvent(new CustomEvent("fx-ready",{detail:this.instance}))}}return customElements.define(t,n),n}function we(t){return t==="display"?"inline":"static"}function D(t=1){let e=t>>>0;return()=>{e=e+1831565813>>>0;let i=e;return i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61),((i^i>>>14)>>>0)/4294967296}}var Y=new Uint8Array(512);{let t=D(1337),e=Array.from({length:256},(i,r)=>r);for(let i=255;i>0;i--){let r=Math.floor(t()*(i+1)),n=e[i];e[i]=e[r],e[r]=n}for(let i=0;i<512;i++)Y[i]=e[i&255]}function C(t){return t*t*t*(t*(t*6-15)+10)}function v(t,e,i,r){let n=t&15,o=n<8?e:i,s=n<4?i:n===12||n===14?e:r;return((n&1)===0?o:-o)+((n&2)===0?s:-s)}function y(t,e,i){return t+(e-t)*i}function j(t,e,i){let r=Math.floor(t),n=Math.floor(e),o=Math.floor(i),s=r&255,c=n&255,a=o&255;t-=r,e-=n,i-=o;let u=C(t),d=C(e),h=C(i),l=Y,m=l[s]+c,g=l[m]+a,O=l[m+1]+a,B=l[s+1]+c,G=l[B]+a,k=l[B+1]+a;return y(y(y(v(l[g],t,e,i),v(l[G],t-1,e,i),u),y(v(l[O],t,e-1,i),v(l[k],t-1,e-1,i),u),d),y(y(v(l[g+1],t,e,i-1),v(l[G+1],t-1,e,i-1),u),y(v(l[O+1],t,e-1,i-1),v(l[k+1],t-1,e-1,i-1),u),d),h)}function _(t,e={}){try{return t.getContext("webgl2",{alpha:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!1,powerPreference:e.powerPreference??"default"})}catch{return null}}var F;function Z(){if(F!==void 0)return F;if(!f)return!1;let t=document.createElement("canvas"),e=_(t);return F=e!==null,e?.getExtension("WEBGL_lose_context")?.loseContext(),F}function ee(t,e,i){let r=n=>{n.preventDefault(),e()};return t.addEventListener("webglcontextlost",r),t.addEventListener("webglcontextrestored",i),()=>{t.removeEventListener("webglcontextlost",r),t.removeEventListener("webglcontextrestored",i)}}var te=`#version 300 es
|
|
3
|
+
out vec2 vUv;
|
|
4
|
+
void main() {
|
|
5
|
+
vec2 corner = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
6
|
+
vUv = corner;
|
|
7
|
+
gl_Position = vec4(corner * 2.0 - 1.0, 0.0, 1.0);
|
|
8
|
+
}`;function K(t,e,i){let r=t.createShader(e);if(!r)throw new Error("[elementalfx] Could not create shader");if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)&&!t.isContextLost()){let n=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`[elementalfx] Shader failed to compile: ${n??"unknown error"}`)}return r}function ie(t,e,i,r={}){let n=Object.entries(r).filter(([,h])=>h!==!1).map(([h,l])=>`#define ${h} ${l===!0?"":l}`).join(`
|
|
9
|
+
`),o=h=>n?h.replace(/^(#version[^\n]*\n)/,`$1${n}
|
|
10
|
+
`):h,s=K(t,t.VERTEX_SHADER,o(e)),c=K(t,t.FRAGMENT_SHADER,o(i)),a=t.createProgram();if(!a)throw new Error("[elementalfx] Could not create program");if(t.attachShader(a,s),t.attachShader(a,c),t.linkProgram(a),t.deleteShader(s),t.deleteShader(c),!t.getProgramParameter(a,t.LINK_STATUS)&&!t.isContextLost()){let h=t.getProgramInfoLog(a);throw t.deleteProgram(a),new Error(`[elementalfx] Program failed to link: ${h??"unknown error"}`)}let u={},d=t.getProgramParameter(a,t.ACTIVE_UNIFORMS)??0;for(let h=0;h<d;h++){let l=t.getActiveUniform(a,h);if(!l)continue;let m=l.name.replace(/\[0\]$/,""),g=t.getUniformLocation(a,l.name);g&&(u[m]=g)}return{program:a,uniforms:u,use:()=>t.useProgram(a),delete:()=>t.deleteProgram(a)}}function re(t){let e=t.createVertexArray();return{draw(){t.bindVertexArray(e),t.drawArrays(t.TRIANGLES,0,3)},delete(){t.deleteVertexArray(e)}}}function ne(t,e={}){let i={internalFormat:t.RGBA8,format:t.RGBA,type:t.UNSIGNED_BYTE,filterable:!1,packed:!0};if(e.forcePacked)return i;let r=t.getExtension("EXT_color_buffer_float")!==null,n=r||t.getExtension("EXT_color_buffer_half_float")!==null;if((e.precision??"float")==="float"&&r){let o={internalFormat:t.RGBA32F,format:t.RGBA,type:t.FLOAT,filterable:t.getExtension("OES_texture_float_linear")!==null,packed:!1};if(J(t,o))return o}if(n){let o={internalFormat:t.RGBA16F,format:t.RGBA,type:t.HALF_FLOAT,filterable:!0,packed:!1};if(J(t,o))return o}return i}function J(t,e){let i=t.createTexture(),r=t.createFramebuffer();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,e.internalFormat,4,4,0,e.format,e.type,null),t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);let n=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null),t.deleteFramebuffer(r),t.deleteTexture(i),n}var w=class{constructor(t,e,i,r,n=r.filterable?t.LINEAR:t.NEAREST){this.gl=t,this.width=e,this.height=i,this.format=r;let o=t.createTexture(),s=t.createFramebuffer();if(!o||!s)throw new Error("[elementalfx] Could not allocate render target");this.texture=o,this.framebuffer=s,t.bindTexture(t.TEXTURE_2D,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,r.internalFormat,e,i,0,r.format,r.type,null),t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o,0),this.clear()}bind(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer),this.gl.viewport(0,0,this.width,this.height)}clear(){let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer),this.format.packed?t.clearColor(127/255,1,127/255,1):t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.bindFramebuffer(t.FRAMEBUFFER,null)}delete(){this.gl.deleteFramebuffer(this.framebuffer),this.gl.deleteTexture(this.texture)}},L=class{constructor(t,e,i,r){this.read=new w(t,e,i,r),this.write=new w(t,e,i,r)}get width(){return this.read.width}get height(){return this.read.height}swap(){let t=this.read;this.read=this.write,this.write=t}clear(){this.read.clear(),this.write.clear()}delete(){this.read.delete(),this.write.delete()}};var p=`#version 300 es
|
|
11
|
+
precision highp float;
|
|
12
|
+
precision highp sampler2D;
|
|
13
|
+
in vec2 vUv;
|
|
14
|
+
out vec4 outColor;
|
|
15
|
+
uniform vec2 uTexel;
|
|
16
|
+
`,T=`
|
|
17
|
+
vec2 uvL() { return vUv - vec2(uTexel.x, 0.0); }
|
|
18
|
+
vec2 uvR() { return vUv + vec2(uTexel.x, 0.0); }
|
|
19
|
+
vec2 uvB() { return vUv - vec2(0.0, uTexel.y); }
|
|
20
|
+
vec2 uvT() { return vUv + vec2(0.0, uTexel.y); }
|
|
21
|
+
`,oe=`${p}
|
|
22
|
+
uniform sampler2D uVelocity;
|
|
23
|
+
uniform sampler2D uSource;
|
|
24
|
+
uniform float uDt;
|
|
25
|
+
uniform float uDissipation;
|
|
26
|
+
void main() {
|
|
27
|
+
vec2 back = vUv - uDt * texture(uVelocity, vUv).xy * uTexel;
|
|
28
|
+
outColor = texture(uSource, back) / (1.0 + uDissipation * uDt);
|
|
29
|
+
}`,se=`${p}${T}
|
|
30
|
+
uniform sampler2D uVelocity;
|
|
31
|
+
void main() {
|
|
32
|
+
vec2 c = texture(uVelocity, vUv).xy;
|
|
33
|
+
float l = texture(uVelocity, uvL()).x;
|
|
34
|
+
float r = texture(uVelocity, uvR()).x;
|
|
35
|
+
float b = texture(uVelocity, uvB()).y;
|
|
36
|
+
float t = texture(uVelocity, uvT()).y;
|
|
37
|
+
// Solid walls: mirror the normal component at the boundary.
|
|
38
|
+
if (uvL().x < 0.0) l = -c.x;
|
|
39
|
+
if (uvR().x > 1.0) r = -c.x;
|
|
40
|
+
if (uvB().y < 0.0) b = -c.y;
|
|
41
|
+
if (uvT().y > 1.0) t = -c.y;
|
|
42
|
+
outColor = vec4(0.5 * (r - l + t - b), 0.0, 0.0, 1.0);
|
|
43
|
+
}`,ae=`${p}${T}
|
|
44
|
+
uniform sampler2D uVelocity;
|
|
45
|
+
void main() {
|
|
46
|
+
float l = texture(uVelocity, uvL()).y;
|
|
47
|
+
float r = texture(uVelocity, uvR()).y;
|
|
48
|
+
float b = texture(uVelocity, uvB()).x;
|
|
49
|
+
float t = texture(uVelocity, uvT()).x;
|
|
50
|
+
outColor = vec4(0.5 * (r - l - t + b), 0.0, 0.0, 1.0);
|
|
51
|
+
}`,ue=`${p}${T}
|
|
52
|
+
uniform sampler2D uVelocity;
|
|
53
|
+
uniform sampler2D uCurl;
|
|
54
|
+
uniform float uCurlStrength;
|
|
55
|
+
uniform float uDt;
|
|
56
|
+
void main() {
|
|
57
|
+
float l = texture(uCurl, uvL()).x;
|
|
58
|
+
float r = texture(uCurl, uvR()).x;
|
|
59
|
+
float b = texture(uCurl, uvB()).x;
|
|
60
|
+
float t = texture(uCurl, uvT()).x;
|
|
61
|
+
float c = texture(uCurl, vUv).x;
|
|
62
|
+
vec2 force = 0.5 * vec2(abs(t) - abs(b), abs(r) - abs(l));
|
|
63
|
+
force /= length(force) + 1e-4;
|
|
64
|
+
force *= uCurlStrength * c;
|
|
65
|
+
force.y = -force.y;
|
|
66
|
+
vec2 velocity = texture(uVelocity, vUv).xy + force * uDt;
|
|
67
|
+
outColor = vec4(clamp(velocity, -1000.0, 1000.0), 0.0, 1.0);
|
|
68
|
+
}`,ce=`${p}
|
|
69
|
+
uniform sampler2D uSource;
|
|
70
|
+
uniform float uValue;
|
|
71
|
+
void main() {
|
|
72
|
+
outColor = texture(uSource, vUv) * uValue;
|
|
73
|
+
}`,le=`${p}${T}
|
|
74
|
+
uniform sampler2D uPressure;
|
|
75
|
+
uniform sampler2D uDivergence;
|
|
76
|
+
void main() {
|
|
77
|
+
float l = texture(uPressure, uvL()).x;
|
|
78
|
+
float r = texture(uPressure, uvR()).x;
|
|
79
|
+
float b = texture(uPressure, uvB()).x;
|
|
80
|
+
float t = texture(uPressure, uvT()).x;
|
|
81
|
+
float divergence = texture(uDivergence, vUv).x;
|
|
82
|
+
outColor = vec4((l + r + b + t - divergence) * 0.25, 0.0, 0.0, 1.0);
|
|
83
|
+
}`,de=`${p}${T}
|
|
84
|
+
uniform sampler2D uPressure;
|
|
85
|
+
uniform sampler2D uVelocity;
|
|
86
|
+
void main() {
|
|
87
|
+
float l = texture(uPressure, uvL()).x;
|
|
88
|
+
float r = texture(uPressure, uvR()).x;
|
|
89
|
+
float b = texture(uPressure, uvB()).x;
|
|
90
|
+
float t = texture(uPressure, uvT()).x;
|
|
91
|
+
vec2 velocity = texture(uVelocity, vUv).xy - 0.5 * vec2(r - l, t - b);
|
|
92
|
+
outColor = vec4(velocity, 0.0, 1.0);
|
|
93
|
+
}`,he=`${p}
|
|
94
|
+
uniform sampler2D uTarget;
|
|
95
|
+
uniform float uAspect;
|
|
96
|
+
uniform vec3 uValue;
|
|
97
|
+
uniform vec2 uPoint;
|
|
98
|
+
uniform float uRadius;
|
|
99
|
+
void main() {
|
|
100
|
+
vec2 p = vUv - uPoint;
|
|
101
|
+
p.x *= uAspect;
|
|
102
|
+
vec3 base = texture(uTarget, vUv).xyz;
|
|
103
|
+
outColor = vec4(base + exp(-dot(p, p) / uRadius) * uValue, 1.0);
|
|
104
|
+
}`,me=`${p}${T}
|
|
105
|
+
uniform sampler2D uDye;
|
|
106
|
+
uniform float uOpacity;
|
|
107
|
+
uniform float uShading;
|
|
108
|
+
void main() {
|
|
109
|
+
vec3 color = texture(uDye, vUv).rgb;
|
|
110
|
+
if (uShading > 0.0) {
|
|
111
|
+
float dx = length(texture(uDye, uvR()).rgb) - length(texture(uDye, uvL()).rgb);
|
|
112
|
+
float dy = length(texture(uDye, uvT()).rgb) - length(texture(uDye, uvB()).rgb);
|
|
113
|
+
vec3 n = normalize(vec3(dx, dy, length(uTexel)));
|
|
114
|
+
float diffuse = clamp(dot(n, vec3(0.0, 0.0, 1.0)) + 0.7, 0.7, 1.0);
|
|
115
|
+
color *= mix(1.0, diffuse, uShading);
|
|
116
|
+
}
|
|
117
|
+
float alpha = clamp(max(color.r, max(color.g, color.b)), 0.0, 1.0) * uOpacity;
|
|
118
|
+
// Premultiplied output: dye adds light where it's dense and fades to clear.
|
|
119
|
+
outColor = vec4(min(color, vec3(1.0)) * uOpacity, alpha);
|
|
120
|
+
}`;var Me={mode:null,colors:"rainbow",brightness:.2,dyeDissipation:1,velocityDissipation:.2,pressure:.8,curl:30,splatRadius:.25,splatForce:6e3,ambient:null,shading:1,opacity:1,quality:"auto",interactive:!0,zIndex:2147483e3,respectReducedMotion:!0,pauseOffscreen:!0,maxPixelRatio:2},P={ink:{},smoke:{colors:["#ffffff"],brightness:.09,dyeDissipation:1.4,velocityDissipation:.5,curl:18,splatRadius:.18,shading:.6},neon:{colors:["#18e7ff","#ff2bd6","#7dff5a","#ffd400","#8a5cff"],brightness:.22,dyeDissipation:1.1,curl:45,shading:.3}},x=[{name:"low",sim:64,dye:256,iterations:10},{name:"medium",sim:96,dye:512,iterations:16},{name:"high",sim:128,dye:1024,iterations:20}];function M(t){let e=t.preset&&P[t.preset]?t.preset:"ink",i={...Me,...P[e]};for(let[r,n]of Object.entries(t))n!==void 0&&(i[r]=n);return i.preset=e,i}function A(t="body",e={}){let i=f?H(t):t;return f&&i===document.documentElement&&(i=document.body),new U(i,e)}var U=class{constructor(e,i){this.settled=!1;this.runtime=null;this.canvas=null;this.state=null;this.mounted=!1;this.destroyed=!1;this.cleanups=[];this.restoreStyles=[];this.random=D(Math.floor(Math.random()*2**31));this.tierIndex=2;this.width=1;this.height=1;this.idleTime=0;this.clock=0;this.wanderers=[];this.frameTimes=[];this.qualityCooldown=3;this.pointers=new Map;this.resizeQueued=!1;this.pointerCleanup=null;if(this.element=e,this.userOptions={...i},this.options=M(this.userOptions),this.ready=new Promise(r=>this.resolveReady=r),!f||!Z()){this.settle(!1);return}this.tierIndex=this.initialTier(),this.runtime=new q({element:e,frame:r=>this.frame(r),pauseOffscreen:this.options.pauseOffscreen,respectReducedMotion:this.options.respectReducedMotion,onReducedMotionChange:r=>r?this.unmount():this.mount()}),this.runtime.reducedMotion?this.settle(!1):this.mount()}get mode(){return this.options.mode??(f&&this.element===document.body?"cursor":"background")}get quality(){return x[this.tierIndex].name}get ambient(){return this.options.ambient??(this.mode==="background"?1:0)}splat(e,i,r,n,o){this.splatScaled(e,i,r,n,o?pe(o):this.nextColor(),1,1)}splatScaled(e,i,r,n,o,s,c){let a=this.state;if(!a)return;let u=this.options.brightness*s;this.applySplat(a,e/this.width,1-i/this.height,r/this.width,-n/this.height,[o[0]*u,o[1]*u,o[2]*u],c),this.idleTime=0,this.runtime?.wake()}burst(e=6,i){for(let r=0;r<e;r++){let n=i?i.x+(this.random()-.5)*40:this.random()*this.width,o=i?i.y+(this.random()-.5)*40:this.random()*this.height,s=this.random()*Math.PI*2,c=(.6+this.random()*.8)*Math.min(this.width,this.height)*.35;this.splat(n,o,Math.cos(s)*c,Math.sin(s)*c)}}set(e){if(this.destroyed)return;let i=this.options;if(this.userOptions={...this.userOptions,...e},this.options=M(this.userOptions),i.respectReducedMotion!==this.options.respectReducedMotion&&this.runtime?.setRespectReducedMotion(this.options.respectReducedMotion),i.quality!==this.options.quality&&(this.tierIndex=this.initialTier(),this.state&&this.allocate(this.state)),(i.mode!==this.options.mode||i.zIndex!==this.options.zIndex||i.maxPixelRatio!==this.options.maxPixelRatio)&&this.mounted){this.unmount(),this.mount();return}i.interactive!==this.options.interactive&&this.bindPointer(),this.idleTime=0,this.runtime?.wake()}clear(){this.state&&(this.state.velocity.clear(),this.state.dye.clear(),this.state.pressure.clear(),this.display())}pause(){this.runtime?.pause()}play(){this.idleTime=0,this.runtime?.play(),this.runtime?.wake()}destroy(){this.destroyed||(this.unmount(),this.destroyed=!0,this.runtime?.destroy(),this.runtime=null,this.settle(!1))}mount(){if(this.mounted||this.destroyed||this.runtime?.reducedMotion)return;let e=document.createElement("canvas");e.setAttribute("aria-hidden","true"),e.dataset.fx="fluid";let i=e.style;if(i.left="0",i.top="0",i.width="100%",i.height="100%",i.display="block",i.pointerEvents="none",this.mode==="cursor")i.position="fixed",i.zIndex=String(this.options.zIndex),document.body.append(e);else{let o=getComputedStyle(this.element);o.position==="static"&&this.stash("position","relative"),o.zIndex==="auto"&&this.stash("z-index","0"),i.position="absolute",i.zIndex="-1",i.borderRadius=o.borderRadius,this.element.prepend(e)}if(this.canvas=e,this.state=this.createGL(),!this.state){e.remove(),this.canvas=null;for(let o of this.restoreStyles.splice(0).reverse())o();this.settle(!1);return}this.mounted=!0,this.cleanups.push(ee(e,()=>{this.state=null},()=>{this.state=this.createGL(),this.runtime?.wake()}));let r=()=>{this.resizeQueued=!0,this.runtime?.wake()},n=new ResizeObserver(r);n.observe(this.mode==="cursor"?document.documentElement:this.element),window.addEventListener("resize",r),this.cleanups.push(()=>{n.disconnect(),window.removeEventListener("resize",r)}),this.bindPointer(),this.measure(),this.mode==="background"&&this.burst(5),this.display(),this.idleTime=0,this.runtime?.wake(),this.settle(!0)}unmount(){if(this.mounted){this.mounted=!1;for(let e of this.cleanups.splice(0))e();this.releaseGL(),this.canvas?.remove(),this.canvas=null,this.pointers.clear();for(let e of this.restoreStyles.splice(0).reverse())e()}}stash(e,i){let r=this.element,n=r.style.getPropertyValue(e);r.style.setProperty(e,i),this.restoreStyles.push(()=>{n?r.style.setProperty(e,n):r.style.removeProperty(e)})}measure(){if(!this.canvas||!this.state)return;let e=this.canvas.getBoundingClientRect();this.width=Math.max(1,e.width),this.height=Math.max(1,e.height);let i=z(this.options.maxPixelRatio);this.canvas.width=Math.max(1,Math.round(this.width*i)),this.canvas.height=Math.max(1,Math.round(this.height*i)),this.allocate(this.state),this.resizeQueued=!1}createGL(){let e=this.canvas;if(!e)return null;let i=_(e,{powerPreference:"low-power"});if(!i)return null;try{let r=ne(i,{precision:"half"});if(r.packed)return console.warn("[elementalfx] fluid: this GPU cannot render to float textures, so the fluid is off."),i.getExtension("WEBGL_lose_context")?.loseContext(),null;let n=c=>ie(i,te,c),o={advect:n(oe),divergence:n(se),curl:n(ae),vorticity:n(ue),scale:n(ce),pressure:n(le),gradient:n(de),splat:n(he),display:n(me)},s={gl:i,format:r,programs:o,quad:re(i),simSize:[0,0],dyeSize:[0,0]};return this.allocate(s),s}catch(r){return console.warn("[elementalfx] fluid: WebGL setup failed.",r),i.getExtension("WEBGL_lose_context")?.loseContext(),null}}allocate(e){let i=x[this.tierIndex],r=fe(i.sim,this.width,this.height),n=fe(i.dye,this.width,this.height),{gl:o,format:s}=e;(e.simSize[0]!==r[0]||e.simSize[1]!==r[1])&&(e.velocity?.delete(),e.pressure?.delete(),e.divergence?.delete(),e.curl?.delete(),e.velocity=new L(o,r[0],r[1],s),e.pressure=new L(o,r[0],r[1],s),e.divergence=new w(o,r[0],r[1],s),e.curl=new w(o,r[0],r[1],s),e.simSize=r),(e.dyeSize[0]!==n[0]||e.dyeSize[1]!==n[1])&&(e.dye?.delete(),e.dye=new L(o,n[0],n[1],s),e.dyeSize=n)}releaseGL(){let e=this.state;if(this.state=null,!e)return;let{gl:i}=e;if(!i.isContextLost()){for(let r of Object.values(e.programs))r.delete();e.quad.delete(),e.velocity.delete(),e.dye.delete(),e.pressure.delete(),e.divergence.delete(),e.curl.delete()}i.getExtension("WEBGL_lose_context")?.loseContext()}pass(e,i,r,n,o){let{gl:s}=e;i.use();let c=0;for(let[a,u]of Object.entries(n)){s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,u);let d=i.uniforms[a];d&&s.uniform1i(d,c),c++}o(i.uniforms),r?r.bind():(s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight)),e.quad.draw()}applySplat(e,i,r,n,o,s,c=1){let{gl:a}=e;a.disable(a.BLEND);let u=this.width/this.height,d=this.options.splatRadius/100*(u>1?u:1)*c,h=this.options.splatForce,l=e.programs.splat;this.pass(e,l,e.velocity.write,{uTarget:e.velocity.read.texture},m=>{a.uniform1f(m.uAspect,u),a.uniform2f(m.uPoint,i,r),a.uniform3f(m.uValue,n*h,o*h,0),a.uniform1f(m.uRadius,d)}),e.velocity.swap(),this.pass(e,l,e.dye.write,{uTarget:e.dye.read.texture},m=>{a.uniform1f(m.uAspect,u),a.uniform2f(m.uPoint,i,r),a.uniform3f(m.uValue,s[0],s[1],s[2]),a.uniform1f(m.uRadius,d)}),e.dye.swap()}step(e,i){let{gl:r,programs:n}=e,o=x[this.tierIndex],s=[1/e.simSize[0],1/e.simSize[1]],c=this.options;r.disable(r.BLEND);let a=(u,d=s)=>{u.uTexel&&r.uniform2f(u.uTexel,d[0],d[1])};this.pass(e,n.curl,e.curl,{uVelocity:e.velocity.read.texture},u=>a(u)),this.pass(e,n.vorticity,e.velocity.write,{uVelocity:e.velocity.read.texture,uCurl:e.curl.texture},u=>{a(u),r.uniform1f(u.uCurlStrength,c.curl),r.uniform1f(u.uDt,i)}),e.velocity.swap(),this.pass(e,n.divergence,e.divergence,{uVelocity:e.velocity.read.texture},u=>a(u)),this.pass(e,n.scale,e.pressure.write,{uSource:e.pressure.read.texture},u=>{a(u),r.uniform1f(u.uValue,Math.max(0,Math.min(1,c.pressure)))}),e.pressure.swap();for(let u=0;u<o.iterations;u++)this.pass(e,n.pressure,e.pressure.write,{uPressure:e.pressure.read.texture,uDivergence:e.divergence.texture},d=>a(d)),e.pressure.swap();this.pass(e,n.gradient,e.velocity.write,{uPressure:e.pressure.read.texture,uVelocity:e.velocity.read.texture},u=>a(u)),e.velocity.swap(),this.pass(e,n.advect,e.velocity.write,{uVelocity:e.velocity.read.texture,uSource:e.velocity.read.texture},u=>{a(u),r.uniform1f(u.uDt,i),r.uniform1f(u.uDissipation,c.velocityDissipation)}),e.velocity.swap(),this.pass(e,n.advect,e.dye.write,{uVelocity:e.velocity.read.texture,uSource:e.dye.read.texture},u=>{a(u),r.uniform1f(u.uDt,i),r.uniform1f(u.uDissipation,c.dyeDissipation)}),e.dye.swap()}display(){let e=this.state;if(!e)return;let{gl:i}=e;i.disable(i.BLEND),this.pass(e,e.programs.display,null,{uDye:e.dye.read.texture},r=>{i.uniform2f(r.uTexel,1/e.dyeSize[0],1/e.dyeSize[1]),i.uniform1f(r.uOpacity,Math.max(0,Math.min(1,this.options.opacity))),i.uniform1f(r.uShading,Math.max(0,Math.min(1,this.options.shading)))})}frame(e){let i=this.state;if(!i||i.gl.isContextLost())return;this.resizeQueued&&this.measure(),this.adaptQuality(e);let r=this.ambient;this.updateWanderers(e,Math.round(r));for(let o of this.pointers.values())o.colorAge+=e;this.step(i,Math.min(e,1/30)),this.display(),this.idleTime+=e;let n=Math.max(4,7/Math.max(.1,this.options.dyeDissipation));r<=0&&this.idleTime>n&&(this.clear(),this.runtime?.sleep())}updateWanderers(e,i){for(;this.wanderers.length<i;)this.wanderers.push({x:this.random()*this.width,y:this.random()*this.height,heading:this.random()*Math.PI*2,seed:this.random()*100,color:this.nextColor(),colorAge:0});this.wanderers.length=Math.max(0,i),this.clock+=e;let r=Math.min(this.width,this.height)*.55;for(let n of this.wanderers){n.heading+=j(this.clock*.35,n.seed,0)*e*3.2;let o=Math.min(this.width,this.height)*.22,s=Math.min(n.x,n.y,this.width-n.x,this.height-n.y);if(s<o){let u=Math.atan2(this.height/2-n.y,this.width/2-n.x);n.heading+=Math.sin(u-n.heading)*e*7*(1-s/o)}let c=Math.cos(n.heading)*r*e,a=Math.sin(n.heading)*r*e;n.x+=c,n.y+=a,(n.x<0||n.x>this.width)&&(n.heading=Math.PI-n.heading,n.x=Math.max(0,Math.min(this.width,n.x))),(n.y<0||n.y>this.height)&&(n.heading=-n.heading,n.y=Math.max(0,Math.min(this.height,n.y))),n.colorAge+=e,n.colorAge>2.5&&(n.color=this.nextColor(),n.colorAge=0),this.splatScaled(n.x,n.y,c,a,n.color,.22,.45)}}adaptQuality(e){if(this.options.quality!=="auto"||this.tierIndex===0||(this.qualityCooldown-=e,this.frameTimes.push(e),this.frameTimes.length>90&&this.frameTimes.shift(),this.qualityCooldown>0||this.frameTimes.length<90))return;this.frameTimes.reduce((r,n)=>r+n,0)/this.frameTimes.length>1/40&&(this.tierIndex--,this.frameTimes=[],this.qualityCooldown=3,this.state&&this.allocate(this.state))}initialTier(){let e=this.options.quality;return e!=="auto"?x.findIndex(r=>r.name===e):f&&typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches?1:2}bindPointer(){if(this.pointerCleanup?.(),this.pointerCleanup=null,!this.options.interactive||!this.mounted)return;let e=this.mode==="cursor"?window:this.element,i=s=>{let c=this.canvas.getBoundingClientRect();return{x:s.clientX-c.left,y:s.clientY-c.top}},r=s=>{let c=s,a=i(c),u=this.pointers.get(c.pointerId);if(!u){this.pointers.set(c.pointerId,{...a,color:this.nextColor(),colorAge:0});return}let d=a.x-u.x,h=a.y-u.y;u.x=a.x,u.y=a.y,!(d===0&&h===0)&&(u.colorAge>.6&&(u.color=this.nextColor(),u.colorAge=0),this.splatScaled(a.x,a.y,d,h,u.color,1,1))},n=s=>{let c=s,a=i(c);this.pointers.set(c.pointerId,{...a,color:this.nextColor(),colorAge:0}),this.burst(3,a)},o=s=>{let c=s;c.pointerType!=="mouse"&&this.pointers.delete(c.pointerId)};e.addEventListener("pointermove",r,{passive:!0}),e.addEventListener("pointerdown",n,{passive:!0}),e.addEventListener("pointerup",o,{passive:!0}),e.addEventListener("pointercancel",o,{passive:!0}),this.pointerCleanup=()=>{e.removeEventListener("pointermove",r),e.removeEventListener("pointerdown",n),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o)},this.cleanups.push(()=>{this.pointerCleanup?.(),this.pointerCleanup=null})}nextColor(){let e=this.options.colors;return e==="rainbow"||e.length===0?Fe(this.random(),1,1):pe(e[Math.floor(this.random()*e.length)])}settle(e){this.settled||(this.settled=!0,this.resolveReady(e))}};function fe(t,e,i){let r=e/i,n=Math.round(t),o=Math.round(t*(r>=1?r:1/r));return r>=1?[o,n]:[n,o]}function pe(t){let e=t.trim().replace("#","");e.length===3&&(e=e.replace(/./g,r=>r+r));let i=Number.parseInt(e,16);return e.length!==6||Number.isNaN(i)?[1,1,1]:[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}function Fe(t,e,i){let r=Math.floor(t*6),n=t*6-r,o=i*(1-e),s=i*(1-n*e),c=i*(1-(1-n)*e);switch(r%6){case 0:return[i,c,o];case 1:return[s,i,o];case 2:return[o,i,c];case 3:return[o,s,i];case 4:return[c,o,i];default:return[i,o,s]}}var Le={preset:{option:"preset",type:"string"},mode:{option:"mode",type:"string"},colors:{option:"colors",type:"list"},brightness:{option:"brightness",type:"number"},"dye-dissipation":{option:"dyeDissipation",type:"number"},"velocity-dissipation":{option:"velocityDissipation",type:"number"},curl:{option:"curl",type:"number"},"splat-radius":{option:"splatRadius",type:"number"},"splat-force":{option:"splatForce",type:"number"},ambient:{option:"ambient",type:"number"},shading:{option:"shading",type:"number"},opacity:{option:"opacity",type:"number"},quality:{option:"quality",type:"string"},interactive:{option:"interactive",type:"boolean"},page:{option:"page",type:"boolean"}};function I(t="fx-fluid"){return Q(t,{attributes:{...Le},hostStyle:{display:"block"},create:(e,i)=>{let{page:r,colors:n,...o}=i,s=n&&n.length===1&&n[0]==="rainbow"?"rainbow":n;return A(r?document.body:e,{...o,...s?{colors:s}:{}})}})}I();return Te(Pe);})();
|
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EACL,OAAO,EACP,cAAc,EACd,KAAK,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type FluidPreset = 'smoke' | 'ink' | 'neon';
|
|
2
|
+
export type FluidMode = 'cursor' | 'background';
|
|
3
|
+
export type FluidQuality = 'auto' | 'low' | 'medium' | 'high';
|
|
4
|
+
export interface FluidOptions {
|
|
5
|
+
/** Starting values for every option below. Default 'ink'. */
|
|
6
|
+
preset?: FluidPreset;
|
|
7
|
+
/**
|
|
8
|
+
* 'cursor': a transparent overlay over the whole page that follows the pointer.
|
|
9
|
+
* 'background': fills the element behind its content. Defaults to 'cursor'
|
|
10
|
+
* on `document.body` and 'background' on any other element.
|
|
11
|
+
*/
|
|
12
|
+
mode?: FluidMode;
|
|
13
|
+
/** Dye colors as CSS hex strings, or 'rainbow' for random hues. */
|
|
14
|
+
colors?: string[] | 'rainbow';
|
|
15
|
+
/** Brightness of injected dye. Default 0.15. */
|
|
16
|
+
brightness?: number;
|
|
17
|
+
/** How fast dye fades, per second. Default 1. */
|
|
18
|
+
dyeDissipation?: number;
|
|
19
|
+
/** How fast motion fades, per second. Default 0.2. */
|
|
20
|
+
velocityDissipation?: number;
|
|
21
|
+
/** Fraction of pressure kept between frames, 0 to 1. Default 0.8. */
|
|
22
|
+
pressure?: number;
|
|
23
|
+
/** Swirl strength (vorticity confinement). Default 30. */
|
|
24
|
+
curl?: number;
|
|
25
|
+
/** Splat size, as a fraction of the area. Default 0.25. */
|
|
26
|
+
splatRadius?: number;
|
|
27
|
+
/** How hard pointer movement pushes the fluid. Default 6000. */
|
|
28
|
+
splatForce?: number;
|
|
29
|
+
/** Invisible strokes that keep a background flowing on its own. Default 0 (cursor) or 1 (background). */
|
|
30
|
+
ambient?: number;
|
|
31
|
+
/** Soft 3D shading from dye density, 0 to 1. Default 1. */
|
|
32
|
+
shading?: number;
|
|
33
|
+
/** Maximum opacity of the overlay, 0 to 1. Default 1. */
|
|
34
|
+
opacity?: number;
|
|
35
|
+
/** Simulation detail. 'auto' starts by device and steps down if frames run slow. Default 'auto'. */
|
|
36
|
+
quality?: FluidQuality;
|
|
37
|
+
/** Pointer movement stirs the fluid. Default true. */
|
|
38
|
+
interactive?: boolean;
|
|
39
|
+
/** CSS z-index of the cursor overlay. Default 2147483000. */
|
|
40
|
+
zIndex?: number;
|
|
41
|
+
/** Skip the effect when the user prefers reduced motion. Default true. */
|
|
42
|
+
respectReducedMotion?: boolean;
|
|
43
|
+
/** Stop animating while scrolled out of view. Default true. */
|
|
44
|
+
pauseOffscreen?: boolean;
|
|
45
|
+
/** Upper bound for devicePixelRatio. Default 2. */
|
|
46
|
+
maxPixelRatio?: number;
|
|
47
|
+
}
|
|
48
|
+
export type ResolvedFluidOptions = Required<Omit<FluidOptions, 'mode' | 'ambient'>> & {
|
|
49
|
+
mode: FluidMode | null;
|
|
50
|
+
ambient: number | null;
|
|
51
|
+
colors: string[] | 'rainbow';
|
|
52
|
+
};
|
|
53
|
+
export declare const presets: Record<FluidPreset, Partial<FluidOptions>>;
|
|
54
|
+
export interface QualityTier {
|
|
55
|
+
name: 'low' | 'medium' | 'high';
|
|
56
|
+
sim: number;
|
|
57
|
+
dye: number;
|
|
58
|
+
iterations: number;
|
|
59
|
+
}
|
|
60
|
+
export declare const tiers: QualityTier[];
|
|
61
|
+
export declare function resolveOptions(options: FluidOptions): ResolvedFluidOptions;
|
|
62
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,MAAM,W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