Skip to content

vaibhavgarg237/ezPointers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezPointers

ezPointers is a lightweight, free and open-source JavaScript library to create beautiful mouse pointers with customised effects.

Table of Contents

Tested with React.

Demo

Demo for Round Pointer:

mousePointerDemo.mp4

Demo for Shoot Pointer:

  • Transition with 0s ( movePointerShoot{transition : "0s"} )->
shootFast.mp4
  • Transition with 0.1s ( movePointerShoot{transition : "0.1s"} )->
shootSlow.mp4

Using ezpointers...

Install npm package

npm install ezpointers

1. Import functions from npm package

For Round Pointer:

import { initRound, movePointerRound } from "ezpointers";

For Shoot Pointer:

import { initShoot, movePointerShoot } from "ezpointers";

2. Create mouse pointer element

initRound();  // Can also pass custom id name , initRound("your-mouse-id");
//OR initShoot();

3. Move/Customize pointer element

Default parameters: To use default mouse pointer with default parameters.

  • color : "white", //background color
  • width : "3.5rem",
  • height : "3.5rem", //adjust for round size
  • transition : "0.2s", //adjust for transition speed
  • transitionDuration : "100ms",
  • mixBlendMode : "difference",
  • zIndex : 100,
  • borderRadius : "9999px",
  • leftOffset : 30,
  • topOffset : 30,
//For Round pointer
movePointerRound({}); // Pass this empty object for default pointer

//For Shoot Pointer
movePointerShoot({});

Customize mouse pointer:

  • For eg: Black pointer with default parameters
movePointerRound({ color: "black" });
  • For eg: Black pointer with bigger size & rest with default parameters
movePointerRound({ color: "black", width: "5rem", height: "5rem" });

React Sample code

  • Round Pointer

import React, { useEffect } from "react";
import { initRound, movePointerRound } from "ezpointers";

initRound();

function Work() {
  useEffect(() => {
    movePointerRound({});
  });
  return <div>Namaste World</div>;
}

export default Work;

  • Shoot Pointer

import React, { useEffect } from "react";
import { initShoot, movePointerShoot } from "ezpointers";

initShoot();

function Work() {
  useEffect(() => {
    movePointerShoot({});
  });
  return <div>Namaste World</div>;
}

export default Work;

Contributing

We welcome and appreciate new contributions. All changes should be committed to *.js files only. If you want to add new CSS/JS files please mention in Readme/create a new issue for reference. Before you open an issue please review below guidelines.

Anyone

  • Have a look at this Readme. Can it be improved? Do you see typos? You can open a PR or reach out to me at [email protected] or twitter.

Creating a PR

When creating a PR please take this points as a reminder:

  • If there's not yet an issue for your PR please first create an issue with a proposal what you would like to do. This will allow me to give feedback and help you no wasting time and motivation
  • Think in iterations (babysteps)
    You can always start a PR and if you feel like adding on more things to it, better branch off and create a new i.e. draft-PR
  • If you work on a more complex PR please dm me on gmail/twitter to get feedback, discuss the best way to tackle the challenge, and to ensure that there's no duplication of work. It's often faster and nicer to chat or call about questions than to do ping-pong comments in PRs.

Code format & preferences

Code Editors

For better support we recommend these extensions:

Commit message format

I prefer Conventional Commits Specification

A specification for adding human and machine-readable meaning to commit messages

Releases

No releases published

Packages

No packages published