jQuery Stars cursor animation


This is a jQuery plugin that adds some "Magic" to your site.

Under "Magic" we means shining stars, which appear when you move your mouse.

This excited effect can be added to the any block element on the site or even on all your site!

It is very easy to use and has some parameters to suit different site backgrounds.

Download

Usage

1. Include jQuery and our script at the bottom of your page:


...

<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="path/to/scripts/jquery-stars.js"></script>

2. Add javascript code to your page or script file:


jQuery('#selector').jstars({
	image_path: 'images', // folder with magic image
	style: 'white',       // optional, color, default: white
	frequency: 12         // optional, from 1 to 19
});
				
				

jQuery('#example-1').jstars({
	image_path: 'images'  
});
				

Example 1: White

This example illustrates "white" style. As you can see we do not specify any parameters, so style and frequency are set to "white" and "12" automatically.


jQuery('#example-1').jstars({
	image_path: 'images'  
});
				

Example 2: Blue

This one illustrates "blue" style.

Also we increased frequency a bit.


jQuery('#example-blue').jstars({
	image_path: 'images',
	style: 'blue',
	frequency: 15
});
				

jQuery('#example-yellow').jstars({
	image_path: 'images',
	style: 'yellow',
	frequency: 20
});
				

Example 3: Yellow

This example illustrates "yellow" style.

And the frequency is set to max value.


jQuery('#example-yellow').jstars({
	image_path: 'images',
	style: 'yellow',
	frequency: 20
});
				

Example 4: Red

This example illustrates "red" style.

The frequency is low here, so the stars shine rarely.


jQuery('#example-red').jstars({
	image_path: 'images',
	style: 'red',
	frequency: 5
});
				

jQuery('#example-green').jstars({
	image_path: 'images',
	style: 'green'
});
				

Example 5: Green

This example illustrates "green" style.


jQuery('#example-green').jstars({
	image_path: 'images',
	style: 'green'
});
				

Example 6: Random

Our plugin has tricky mode - to show all stars colors randomly.

You should use style "rand" for this feature.


jQuery('#example-rand').jstars({
	image_path: 'images',
	style: 'rand'
});
				

Plugin options

Please find the full list of options below:


jQuery('#example-rand').jstars({
	image_path: '', // this is requried option
	image: 'jstar-map.png', // this is requried option
	style: 'white',
	frequency: 12,
	// if you check the sprite image you will see it has
	// several rows of different colors
	// style map sets the coordinates of each row
	style_map: { 
		white: 0,
		blue: -27,
		green: -54,
		red: -81,
		yellow: -108
	},
	width: 27, // single star width
	height: 27, // single star height
	delay: 300 // rotate speed
});
				

Customize the image

You can try to prepare your own asset to display different image instead of stars.

To do that you should make a sprite of 9 images, each next part is differ from previous with 40 degrees angle.

Let's try how candy cane looks... It will be good for Xmas eve :)


jQuery('#example-rand').jstars({
	image_path: 'images',
	image: 'candy-cane-stars.png',
	style: 'white',
	width: 34,
	height: 34,
	delay: 700,
	frequency: 5
});
				

Old-school stars

For old-school designs we have first version of stars which were released in v1.


jQuery('#custom2').jstars({
	image_path: 'images',
	image: 'jstar-map.png',
	style: 'rand',
	width: 27,
	height: 27,
	style_map: {
		white: 0,
		blue: -27,
		green: -54,
		red: -81,
		yellow: -108
	},
	delay: 300
});