CursorPop - Make your cursor POP!
A simple, lightweight JS library for making custom cursor particles.
.gif)
Website
angelina-tsuboi.github.io/CursorPop
Installation
npm i cursorpop
CDN
Add to your HTML:
<link href="https://unpkg.com/[email protected]/cursorpop.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/cursorpop.js"></script>
Setup
Example HTML with NPM installation template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Template</title>
<link rel="stylesheet" href="./node_modules/cursorpop/cursorpop.css">
<style>.main{width: 100vw; height: 100vh;}</style>
</head>
<body>
<div class="main">
<h1>Testing CursorPop</h1>
</div>
<script src="./node_modules/cursorpop/cursorpop.js"></script>
<script src="script.js"></script>
</body>
</html>
Example HTML with CDN template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Template</title>
<style>.main{width: 100vw; height: 100vh;}</style>
<link href="https://unpkg.com/[email protected]/cursorpop.css" rel="stylesheet">
</head>
<body>
<div class="main">
<h1>Testing CursorPop</h1>
</div>
<script src="https://unpkg.com/[email protected]/cursorpop.js"></script>
<script src="script.js"></script>
</body>
</html>
JS setup
let cursorPop = cursorpop();
document.body.onclick = function(e){
cursorPop.pop(e.pageX, e.pageY)
}
Or with JQuery
let cursorPop = cursorpop();
$('body').on('click', function(e) {
cursorPop.pop(e.pageX, e.pageY)
})
Reference
Constructor
let cursorPop = cursorpop();
Generate Particles
cursorPop.pop(x, y);
Appearance
cursorPop.set(amount, size, smoothness, colors, speed);
cursorPop.color(color);
cursorPop.color(colors);
cursorPop.smoothness(smoothness);
cursorPop.speed(speed);
cursorPop.size(size);
cursorPop.amount(amount);
Get involved
Please have a look at the contribution guidelines before submitting contributions.
Questions?
Feel free to email us any questions! Our contact info is on the CursorPop website.
License
This project is licensed under MIT. Please read the LICENSE for details.
评论