• Stars
    star
    3,355
  • Rank 13,346 (Top 0.3 %)
  • Language
    JavaScript
  • Created almost 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Old-school cursor effects for your browser built with modern JavaScript

90s Cursor Effects

"Knowing the codes" used to be all the rage, I want to bring a few back.

A repo of the old effects that inspired creativity and the desire to learn at least a little code around the world. Modernised so they're a little more efficient, and just as annoying (and twice as fun) as they were before. Have a play here.

The current effects are:

  • Rainbow Cursor
  • Emoji Rain
  • Elastic Emoji
  • Ghost Following
  • Trailing Cursor
  • Text Flag Cursor
  • Following Dot
  • Bubbles Particles
  • Snowflake Particles
  • Fairy Dust
  • Clock Cursor

How to Set Up Locally/Develop

  1. First the packages request (this is only rollup, which code compilation) with npm install
  2. npm run watch This will compile the src in the dist folder that index.html is looking for and update it when changes are made. You can then go to index.html in the web browser of your choice.

How to Use

You need to include the following script tag in your webpage (see next section if you want to use this package via npm). And then, once the script is loaded you'll be able to add the effects to the page

<script src="https://unpkg.com/cursor-effects@latest/dist/browser.js"></script>

Alternatively you can use a type="module" script on newer browsers with a import statement, if you are using the esm module you will import the cursor specific to your needs, rather than having to use the cursoreffects.x style.

<script type="module">
  import { fairyDustCursor } from "https://unpkg.com/cursor-effects@latest/dist/esm.js";

  new fairyDustCursor();
</script>

And then create a new instance of its type in your JavaScript. The script will create the canvas that is used, so nothing else is really needed.

window.addEventListener("load", (event) => {
  new cursoreffects.ghostCursor();
});

You can also target specific elements, to have the canvas appear inside those, for example:

const targetElement = document.querySelector("#ghost");
new cursoreffects.ghostCursor({ element: targetElement });

To remove the effect, you can call destroy on it.

// Create
let cursorEffect = new ghostCursor();

// Destroy
cursorEffect.destroy()

or you can use NPM

npm install cursor-effects
import { emojiCursor } from "cursor-effects";
new emojiCursor({ emoji: ["🔥", "🐬", "🦆"] });

Specific Customization

A few of these have custom options as well (if you are interested in more options, opening an issue or PR is the way to go).

rainbowCursor

You can change the colors, size and length in rainbowCursor

new cursoreffects.rainbowCursor({
  length: 3,
  colors: ["red", "blue"],
  size: 4,
});

springyEmojiCursor

You can change the emoji in springyEmojiCursor's emoji with the emoji a single string emoji.

new cursoreffects.springyEmojiCursor({ emoji: "🤷‍♂️" });

fairyDustCursor

You can change the emoji in fairyDustCursor's colors with the colors option (an array of colors)

new cursoreffects.fairyDustCursor({
  colors: ["#ff0000", "#00ff00", "#0000ff"],
});

emojiCursor

You can change the emoji in emojiCursor's emoji with the emoji option (a list of emoji)

new cursoreffects.emojiCursor({ emoji: ["🔥", "🐬", "🦆"] });

textFlag

You can change the textFlag's text with the text option (String), and color of the text with the color option (hex)

 new textFlag({text: "test",color:["#FF6800"]});

Accessibility

The cursor won't display if the user's system accessibility settings have prefers-reduced-motion enabled.

trailingCursor

You can change the number of trail steps in trailingCursor with the particles option (a number), the rate of the trail with the rate option (a number between 0 and 1, default is 0.4), and the trailing cursor image with the baseImageSrc option (a URL or base64 string)

new cursoreffects.trailingCursor({particles: 15, rate: 0.8, baseImageSrc: "data:image/png;base64,iVB..."});

You can change the color of the following dot in followingDotCursor with the color option (hex)

new cursoreffects.followingDotCursor({ color: ["#323232a6"] });

License

MIT af, but if you're using the scripts a GitHub sponsorship or shouting me a coffee would always be appreciated :)

More Repositories

1

elevator.js

Finally, a "back to top" button that behaves like a real elevator.
JavaScript
6,622
star
2

github-corners

A fresher "Fork me on GitHub" callout.
HTML
4,931
star
3

zenpen

A minimalist writing zone.
JavaScript
3,764
star
4

intense-images

A simple library to view large images up close using simple mouse interaction, and the full screen.
JavaScript
2,577
star
5

generative-artistry

A website for self coding generative art tutorials.
JavaScript
837
star
6

giflinks

The best thing to happen to the internet since the <a> tag.
JavaScript
796
star
7

dom-animator

A nifty javascript library to run animations, hidden in comment nodes, within the dom.
JavaScript
628
star
8

ascii-morph

Library to animate between two ascii images -
JavaScript
582
star
9

obnoxious.css

Animations for the strong of heart, and stupid of mind.
CSS
510
star
10

console-dot-frog

Forget console logs, console.frog is where its all at!
JavaScript
317
star
11

overscroll

Javascript for adding small easter eggs when over scrolling on apple devices.
JavaScript
298
star
12

texter

Texter is a little app that lets you explore your creativity by drawing with text.
JavaScript
274
star
13

the-indie-web

A hotspot for indie creations on the web
CSS
254
star
14

tutorial-markdown

Interactive coding tutorials with markdown
JavaScript
246
star
15

what-have-you-made-today

Chrome & FireFox extension to replace the default home page. What have you made today?
Vue
232
star
16

discreet-twitter-ui

A minimal ui/ux concept for twitter buttons allowing hover reveals under an icon.
CSS
221
star
17

office-simulator

Miss the office life? You won't any more with this wonderful office slack simulator.
JavaScript
161
star
18

tileJs

Windows Metro Tiles with css3 and javascript
JavaScript
154
star
19

buddy

Chrome extension, and friend from hell
JavaScript
134
star
20

smelvetica

Sorry y'all, got a takedown from monotype.
134
star
21

bsod.js

Blue screen of death for the web, because debugging shouldn't be easy.
JavaScript
111
star
22

binary-music-player

A binary music player, with customizable notes & playback.
HTML
101
star
23

mosquito-js

An annoying mosquito created with the web audio api.
JavaScript
96
star
24

unicoder.js

A small js library to convert text into ⓣⓔⓧⓣ.
JavaScript
92
star
25

console-fright-night

Open the browser console, get a fright. Just like that!
JavaScript
88
star
26

the-zen-zone

Digital meditation aid
JavaScript
83
star
27

the-pattern-library

A library of beautiful patterns, created by talented designers.
JavaScript
77
star
28

palettab

New fonts and colors with every new tab.
JavaScript
69
star
29

image-nodes

Javascript experiment using image data to create a small interactive particle system
CSS
60
star
30

emoji-intensifies

A quick and simple tool to make shaky "intensifies" emoji.
JavaScript
55
star
31

meettheipsums

A website to link out to all of the awesome filler text in the world.
HTML
52
star
32

s.js

Canvas JavaScript polyfill for the vital and pivotal S we all drew in school.
JavaScript
51
star
33

the-internet

Basically the internet (or most important parts) in a module.
JavaScript
49
star
34

resizer

A small library to improve the user experience of a text box, by decreasing the font size slightly if it is filled with text.
JavaScript
49
star
35

beautiful-curves

A simple generative drawing app using the html5 canvas
JavaScript
39
star
36

cant-not-tweet-this

Taking annoying social media popup crap to the next level!
CSS
38
star
37

long-doge-challenge

The Long Doge Challenge
HTML
36
star
38

concentrics

A little web experiment, using concentric circles and squares to create abstract arty stuff!
JavaScript
35
star
39

abstract-clocks

Abstract Clocks, telling the time in abstract & beautiful ways.
HTML
34
star
40

tetris-pieces

A beautiful AI Tetris, playing on your wall!
JavaScript
33
star
41

rasterizer

Experimenting with rasterization with javascript + the html5 canvas
JavaScript
30
star
42

checkboxrace

A checkbox based race
HTML
29
star
43

asciiFaceSaver

An osx screen saver, looping over various ascii faces. Written in Swift.
Swift
26
star
44

interactive-banners

A few html5 experiments using js/canvas to create interactive banners
JavaScript
26
star
45

puginarug

Honor the Pug in a Rug
HTML
24
star
46

mondrian-and-me

A "Useless Website" honoring Piet Mondrian's fantastic art.
HTML
23
star
47

useless-web-archive

An archive for the sites of "the useless web"
HTML
23
star
48

Dripping-Paint

Small html5 canvas experiment to simulate a simple dripping paint effect
JavaScript
20
star
49

tholman-blog

Source to my personal blog and website.
CSS
19
star
50

thats-the-finger

The finger. Thats it.
JavaScript
14
star
51

star-spangled-browser

A chrome plugin to blow minds when hovering the word america.
JavaScript
13
star
52

one-square-minesweeper

A game of minesweeper with only one square to sweep. Fun for the whole family.
CSS
11
star
53

scripts-for-life

A few bash shells scripts I use to make life easier.
Shell
9
star
54

human-music

Sit back and stretch your legs and enjoy the relaxing tunes of Earth radio.
HTML
5
star
55

tholman

A repo about me!
1
star
56

reflex-toys

Reflex Toys
HTML
1
star