Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
fluid-simulation-react
Advanced tools
A React library which shows multi-colored fluid effects on cursor movements. On cursor movements or touch you can make smoke like effects. Ideal for adding dynamic, visually engaging elements to application.
fluid-simulation-react is a simple yet captivating React component based on WebGL fluid simulation. It provides an easy way to integrate fluid-like animations into your React applications, offering beautiful interaction with minimal setup.
To use fluid-simulation-react in your project, you can install it via npm:
npm install fluid-simulation-react
To integrate the fluid simulation into your React application, simply import and use the FluidSimulation component:
import React from 'react';
import FluidSimulation from 'fluid-simulation-react';
const MyComponent = () => {
return <FluidSimulation />;
};
export default MyComponent;
Custom Configuration and color
fluid-simulation-react allows you to customize the fluid simulation behavior through a config prop. Here is how you can use it:
import React from 'react';
import FluidSimulation from 'fluid-simulation-react';
const MyComponent = () => {
const customConfig = {
textureDownsample: 2,
densityDissipation: 0.80,
};
const customColors = [
[1, 1, 0], // Yellow
[0, 1, 1] // Cyan
]
return <FluidSimulation config={customConfig} color={customColors}/>;
};
export default MyComponent;
Default Configuration
The default configuration for fluid-simulation-react is as follows:
const defaultConfig = {
textureDownsample: 1,
densityDissipation: 0.98,
velocityDissipation: 0.99,
pressureDissipation: 0.8,
pressureIterations: 25,
curl: 30,
splatRadius: 0.005,
};
const color = [
Math.random() + 0.2,
Math.random() + 0.2,
Math.random() + 0.2,
];
You can override any of these settings with your own values in the customConfig and you can choose one or muliple color, In that case expect onmove color will be from that only(randomly for multiple color)
- Allowing users to choose colors dynamically based on cursor movement = DONE.
- Options for cursor movement or click effects.
- More customizable settings and options.
For a better understanding of the component or if you wish to contribute, please check out the GitHub repository:
fluid-simulation-react on GitHub.
ping me on discord: kiyo07
Thanks for Trying this(Or atleast for reading, do try it out share me where do I need to imporve).
FAQs
A React library which shows multi-colored fluid effects on cursor movements. On cursor movements or touch you can make smoke like effects. Ideal for adding dynamic, visually engaging elements to application.
We found that fluid-simulation-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.