1.3.2 • Published 4 months ago

@whatisjery/react-fluid-distortion v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Version

Fluid Distortion for React Three Fiber

screen capture

Implementing post-processing fluid distortion effects in response to cursor interactions for React-Three-Fiber. Based on the shaders developed by Pavel Dobryakov

Try it :

codesandbox

Installation :

npm install @whatisjery/react-fluid-distortion @react-three/drei @react-three/postprocessing postprocessing leva

Example of use :

import { Fluid } from '@/whatisjery/react-fluid-distortion';
import { EffectComposer } from '@react-three/postprocessing';
import { Canvas } from '@react-three/fiber';

<Canvas
    style={{
        position: 'fixed',
        top: 0,
        left: 0,
        height: '100vh',
        width: '100vw',
        background: '#000000',
    }}>
    <EffectComposer>
        <Fluid />
        {... other effets}
    </EffectComposer>
</Canvas>;

Display configuration panel :

Show a debug panel to test options more easily.

const config = useConfig();

...

<Fluid {...config} />

Options :

NameTypeDefault ValueDescription
fluidColorhexadecimal#005effSets the fluid color. Effective only when rainbow is set to false.
backgroundColorstring#070410Sets the background color. Effective only when showBackground is true.
showBackgroundbooleanfalseToggles the background color's visibility. If false it becomes transprent.
blendnumber5Blends fluid into the scene when showBackground is true. Valid range: 0.00 to 10.0.
intensitynumber10Sets the fluid intensity. Valid range: 0 to 10.
forcenumber2Multiplies the mouse velocity to increase fluid splatter. Valid range: 0.0 to 20.
distortionnumber2Sets the distortion amount. Valid range: 0.00 to 2.00.
radiusnumber0.3Sets the fluid radius. Valid range: 0.01 to 1.00.
curlnumber10Sets the amount of the curl effect. Valid range: 0.0 to 50.
swirlnumber20Sets the amount of the swirling effect. Valid range: 0 to 20.
velocityDissipationnumber0.99Reduces the fluid velocity over time. Valid range: 0.00 to 1.00.
densitionDissipationnumber0.95Reduces the fluid density over time. Valid range: 0.00 to 1.00.
pressurenumber0.80Controls the reduction of pressure. Valid range: 0.00 to 1.00.
rainbowbooleantrueActivates color mode based on mouse direction. No range applicable as this is a boolean value.
1.3.2

4 months ago

1.3.1

4 months ago

1.3.0

4 months ago

1.2.0

4 months ago

1.1.0

4 months ago

0.1.0

4 months ago

1.0.12

4 months ago

1.0.11

4 months ago

1.0.10

4 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago