@slithy/math-particles 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -3
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ type Props = {
|
|
|
5
5
|
colors?: string[];
|
|
6
6
|
density?: number;
|
|
7
7
|
reverse?: boolean;
|
|
8
|
+
transitionDuration?: number;
|
|
8
9
|
};
|
|
9
|
-
declare const MathParticlesOverlay: ({ backgroundColor, colors, density, reverse, }: Props) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare const MathParticlesOverlay: ({ backgroundColor, colors, density, reverse, transitionDuration, }: Props) => react_jsx_runtime.JSX.Element;
|
|
10
11
|
|
|
11
12
|
export { MathParticlesOverlay };
|
package/dist/index.js
CHANGED
|
@@ -198,8 +198,7 @@ var DEFAULT_COLORS = [
|
|
|
198
198
|
"#fdae61",
|
|
199
199
|
"#f46d43",
|
|
200
200
|
"#d73027",
|
|
201
|
-
"#a50026"
|
|
202
|
-
"#ffffff"
|
|
201
|
+
"#a50026"
|
|
203
202
|
];
|
|
204
203
|
function rand(a, b) {
|
|
205
204
|
return a + Math.random() * (b - a);
|
|
@@ -283,7 +282,8 @@ var MathParticlesOverlay = ({
|
|
|
283
282
|
backgroundColor = "#07070f",
|
|
284
283
|
colors = DEFAULT_COLORS,
|
|
285
284
|
density = 1,
|
|
286
|
-
reverse = false
|
|
285
|
+
reverse = false,
|
|
286
|
+
transitionDuration = 800
|
|
287
287
|
}) => {
|
|
288
288
|
const containerRef = useRef(null);
|
|
289
289
|
const colorsRef = useRef(colors);
|
|
@@ -293,6 +293,10 @@ var MathParticlesOverlay = ({
|
|
|
293
293
|
useEffect(() => {
|
|
294
294
|
const container = containerRef.current;
|
|
295
295
|
if (!container) return;
|
|
296
|
+
container.style.transition = `opacity ${transitionDuration}ms ease`;
|
|
297
|
+
container.style.opacity = "0";
|
|
298
|
+
void container.offsetHeight;
|
|
299
|
+
container.style.opacity = "1";
|
|
296
300
|
let w = container.clientWidth;
|
|
297
301
|
let h = container.clientHeight;
|
|
298
302
|
const count = Math.max(1, Math.floor(w * h / 55e3 * density));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slithy/math-particles",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Animated math equations particle overlay for React.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"tsup": "^8",
|
|
31
31
|
"typescript": "^5",
|
|
32
32
|
"vitest": "^4.1.2",
|
|
33
|
-
"@slithy/
|
|
34
|
-
"@slithy/
|
|
33
|
+
"@slithy/tsconfig": "0.0.0",
|
|
34
|
+
"@slithy/eslint-config": "0.0.0"
|
|
35
35
|
},
|
|
36
36
|
"author": {
|
|
37
37
|
"name": "Matthew Campagna",
|