Skip to content

Commit 3a96ecf

Browse files
author
Stefano Vavassori
committed
update component description
1 parent 83c49d1 commit 3a96ecf

22 files changed

+47
-35
lines changed

content/components/3d-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: '3d Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that adds a 3d effect to the cursor.',
55
};
66

77
<ComponentCodePreview name='3d-cursor' />

content/components/arrow-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Arrow Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
"An interactive React component that draws a dynamic arrow inside a circle, pointing up or down based on the cursor's vertical movement, providing a visual response to the user's cursor direction.",
55
};
66

77
<ComponentCodePreview name='arrow-cursor' />

content/components/blob-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Blob Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that adds a dynamic blob effect, visually tracking and interacting with cursor movements in real time.',
55
};
66

77
<ComponentCodePreview name='blob-cursor' />

content/components/canvas-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Canvas Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that creates dynamic trailing lines following the cursor, generating smooth and fluid motion trails that react in real time to cursor movement.',
55
};
66

77
<ComponentCodePreview name='canvas-cursor' />

content/components/character-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Character Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'A React component that tracks cursor movement and creates characters that radiate outward, generating a dynamic and expanding effect.',
55
};
66

77
<ComponentCodePreview name='character-cursor' />

content/components/clickeffect-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Click Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'A React component that dynamically follows the cursor with a circle and responds to clicks with visual effects.',
55
};
66

77
<ComponentCodePreview name='clickeffect-cursor' />

content/components/fairydust-cursor.mdx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Fairy Dust Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that creates a magical fairy dust effect, generating a trail of sparkling emoji particles that follow the cursor in real time.',
55
};
66

77
<ComponentCodePreview name='fairydust-cursor' />
@@ -10,7 +10,7 @@ export const metadata = {
1010

1111
```tsx
1212
'use client';
13-
import React, { useEffect, useRef, useState } from 'react';
13+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
1414

1515
interface FairyDustCursorProps {
1616
colors?: string[];
@@ -54,7 +54,27 @@ export const FairyDustCursor: React.FC<FairyDustCursorProps> = ({
5454
const particlesRef = useRef<Particle[]>([]);
5555
const cursorRef = useRef({ x: 0, y: 0 });
5656
const lastPosRef = useRef({ x: 0, y: 0 });
57-
const [canvasSize, setCanvasSize] = useState({ width: 0, height: 0 });
57+
const [canvasSize, setCanvasSize] = useState({
58+
width: element ? element.clientWidth : window.innerWidth,
59+
height: element ? element.clientHeight : window.innerHeight,
60+
});
61+
62+
useLayoutEffect(() => {
63+
const updateCanvasSize = () => {
64+
const newWidth = element ? element.clientWidth : window.innerWidth;
65+
const newHeight = element ? element.clientHeight : window.innerHeight;
66+
67+
console.log('vavva updateCanvasSize', newWidth, newHeight);
68+
setCanvasSize({ width: newWidth, height: newHeight });
69+
};
70+
71+
updateCanvasSize();
72+
window.addEventListener('resize', updateCanvasSize);
73+
74+
return () => {
75+
window.removeEventListener('resize', updateCanvasSize);
76+
};
77+
},[element])
5878

5979
useEffect(() => {
6080
const canvas = canvasRef.current;
@@ -64,16 +84,8 @@ export const FairyDustCursor: React.FC<FairyDustCursorProps> = ({
6484
const context = canvas.getContext('2d');
6585
if (!context) return;
6686

67-
const updateCanvasSize = () => {
68-
const newWidth = element ? targetElement.clientWidth : window.innerWidth;
69-
const newHeight = element
70-
? targetElement.clientHeight
71-
: window.innerHeight;
72-
setCanvasSize({ width: newWidth, height: newHeight });
73-
};
74-
75-
updateCanvasSize();
76-
window.addEventListener('resize', updateCanvasSize);
87+
canvas.width = canvasSize.width;
88+
canvas.height = canvasSize.height;
7789

7890
// Animation frame setup
7991
let animationFrameId: number;
@@ -181,7 +193,6 @@ export const FairyDustCursor: React.FC<FairyDustCursorProps> = ({
181193
animate();
182194

183195
return () => {
184-
window.removeEventListener('resize', updateCanvasSize);
185196
targetElement.removeEventListener('mousemove', handleMouseMove);
186197
targetElement.removeEventListener('touchmove', handleTouchMove);
187198
cancelAnimationFrame(animationFrameId);
@@ -195,6 +206,7 @@ export const FairyDustCursor: React.FC<FairyDustCursorProps> = ({
195206
gravity,
196207
fadeSpeed,
197208
initialVelocity,
209+
canvasSize,
198210
]);
199211

200212
return (

content/components/follow-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Follow Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that tracks the cursor with a small gray circle, creating a smooth following effect.',
55
};
66

77
<ComponentCodePreview name='follow-cursor' />

content/components/glitch-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Glitch Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that applies a glitch effect to elements when the cursor hovers over them, creating a distorted, digital disruption effect in real time.',
55
};
66

77
<ComponentCodePreview name='glitch-cursor' />

content/components/gradient-cursor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const metadata = {
22
title: 'Gradient Cursor Effect',
33
description:
4-
'An interactive React component that adds a dynamic bubble effect, visually tracking cursor movement in real time.',
4+
'An interactive React component that adds a dynamic gradient effect, visually tracking cursor movement in real time.',
55
};
66

77
<ComponentCodePreview name='gradient-cursor' />

0 commit comments

Comments
 (0)