npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-very-cool-cursor

v3.4.3

Published

An animated custom cursor component in React.

Downloads

41

Readme

React Animated Cursor

A React functional component that replaces the native cursor with a custom animated jawn. As this is a function component, hooks manage events, local state and RAF.

The custom cursor is comprised of

  • An inner dot (cursorInner)
  • An outer, outlining circle (cursorOuter), with slight opacity based on the dot/primary color
  • A slight trailing animation of the outer outline
  • An inversely scaling effect between the inner and outer cursor parts on click or link hover

Options exist for modifying the color and scaling of the cursor elements (see props/options below).

Live Demo

Install package from npm

npm i react-animated-cursor

Instal Project Dependencies

npm install

Build

npm run build

Run Demo

npm run demo:start

Build Demo

npm run demo:build

Clean Demo

npm run clean:demo

Demo

The demo is bundled with Parcel.js and served up at http://localhost:1234/.

Lib

The core component file is housed in lib/

Dist

On build, lib populates dist with commonjs, es, umd versions of the component.

Example Usage

import React from "react";
import AnimatedCursor from "react-animated-cursor"


export default function App() {
  return (
    <div className="App">
      <AnimatedCursor />
    </div>
  );
}

Example Usage - with options

import React from "react";
import AnimatedCursor from "react-animated-cursor"

export default function App() {
  return (
    <div className="App">
    <AnimatedCursor
      innerSize={8}
      outerSize={8}
      color='193, 11, 111'
      outerAlpha={0.2}
      innerScale={0.7}
      outerScale={5}
    />
    </div>
  );
}

If not using via npm install, then import from directory

Example Usage - from lib

import React from "react";
import AnimatedCursor from "./AnimatedCursor";

With SSR (Server Side Rendering)

With Next.js, you can leverage a Dynamic Imports to set ssr:false for AnimatedCursor. Honestly though, you might not have to do that anymore since v2.1.5

Next.js SSR Example

import dynamic from 'next/dynamic'

const AnimatedCursor = dynamic(() => import('react-animated-cursor'), {
  ssr: false
});

// <AnimatedCursor/>

Cursor Styling

Cursor styling is included within the component, using a simple dependency-free inline approach. Default properties use es6 default parameters, as defaultProps, is slated for deprecation.

Options / Props

| Option | Type | Description | Default | | --- | --- | --- | --- | | color | string | rgb value | 220, 90, 90 | | outerAlpha | number | amount of alpha transparency for cursor outline | 0.4 | | innerSize | number | Size (px) of inner cursor dot | 8 | | outerSize | number | Size (px) of outer cursor outline | 8 | | innerScale | number | amount dot scales on click or link hover | 0.7 | | outerScale | number | amount outline scales on click or link hover | 5 |

Mobile / Touch

helpers/isDevice.js uses UA sniffing to determine if on a common device so we can avoid rendering cursors

Todo

  • ~~Either remove on mobile, or provide touch events.~~
  • ~~Separate click and hover scalings to provide a different scaling when clicking on links~~

Have fun ya'll.