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

custom-curses

v0.1.18

Published

A simple Library to add beautiful custom cursors to your webpage.

Downloads

25

Readme

Custom CURSES

Beautiful Cursors

ts

A simple Library to add custom cursors to your Webpage in Javascript. It utilizes the HTMLCanvasElement .

Examples: https://custom-curses.vercel.app/

Preview:

import { Cursor, Pointer, initializeCanvas } from "custom-curses";
const pointer1 = new Pointer({
  pointerShape: ["string", "👆"],
  size: 50,
  drag: 0.1,
  xCharOffset: 18,
  yCharOffset: 85,
  rotation: -40,
  xOffset: 0,
  yOffset: 0,
});

const pointer2 = new Pointer({
  pointerShape: ["string", "༼ つ ◕_◕ ༽つ"],
  size: 20,
  drag: 0.97,
  xOffset: 200,
  yOffset: 100,
});

const cursor1 = new Cursor({
  pointers: [pointer1, pointer2],
  drag: 0, //where 1 is max
  hideMouse: true,
});

let cleanup = initializeCanvas(cursor1); // this function returns a cleanup function that can be used to dispose all the cursors/pointers cleanly

Preview GIF

React

You only need to wrap the initializeCanvas function in a useEffect hook

More example usages in ./examples/ or https://custom-curses.vercel.app/

Features

  • It accepts Emojis, and any string you can use in the canvas normally and the rotation of said characters.

  • It now accepts any images that can be used with the HTMLCanvas directly, but animated GIF images will only render the first frame of the GIF.

  • You can adjust the drag on each individual pointer and for the cursor as a whole.

  • You can adjust the X and Y offset for each pointer individually and for the cursor as a whole.

  • The library now works with React (just wrap it in a useEffect)

  • The library now works with Next (just wrap it in a useEffect, and also wrap import the page using dynamic imports, see: Issue #10)

The way it works

  • Several Pointer objects can be bound to a cursor Object. You can theoretically pass in an infinite number of Pointers to the cursor.
  • The cursor object is then drawn to the canvas. For each animation loop it waits for all canvas objects to draw and update before clearing the canvas.
  • A canvas object is instantiated and bound to the Cursor Object.
  • The canvas element is only allowed to have 1 Cursor Object, not sure why anyone would want other wise.

Installation

Using npm: npm install custom-curses

Provision will be made for a cdn link

Development

Want to contribute? Great! Make an Issue!