1.0.1 • Published 4 months ago

@stichiboi/react-elegant-mouse-trail v1.0.1

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

react-elegant-mouse-trail

A plug and play react element that follows your cursor.

Every frame, it records the position of the mouse. Then it draws an arc between all the points, creating a cool trail.

Install with

npm i @stichiboi/react-elegant-mouse-trail

Then use it in your components

import { MouseTrail } from "@stichiboi/react-elegant-mouse-trail";

export function Layout({ children }: { children: ReactNode }): JSX.Element {
    return (
        <>
            <MouseTrail strokeColor={"#FF8541"}/>
            <main>{children}</main>
        </>
    );
}

Demo

See it in action

Or you can clone the repo and run

npm storybook

Options

Prop nameTypeDescription
lineDurationnumberHow long it takes for the trail to fade away
lineWidthStartnumberThe size of the points when they are created
strokeColorstringColor of the trail. It should be in a format accepted by strokeStyle. E.g. "rgb(255, 0, 0)")
lagnumberHow long it takes for the trail head to reach the cursor. Should be in the range [0, 1)
1.0.1

4 months ago

1.0.0

4 months ago

0.1.9

5 months ago

0.1.8

1 year ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago