jQuery Plugin To Create Starry Background Using Canvas - Starfield

File Size: 8.35 KB
Views Total: 2577
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Create Starry Background Using Canvas - Starfield

Starfield is a tiny jQuery plugin to create a canvas based, interactive moving starry background that reacts to your mouse cursor.

How to use it:

1. Include jQuery library and the jQuery starfield plugin on your webpage.

<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="dist/jquery-starfield.js"></script>

2. Create a DIV element that will be served as the background container for your webpage.

<div style="width:100%;height:100%"></div>

3. Call the plugin on the DIV element and setup the starry background.

$('div').starfield({

// how dense you want your starfield to be
starDensity: 1.0,

// how quickly the starfield scrolls in response to mouse movement
mouseScale: 1.0,

// start with a moving starfield on load
seedMovement: true

});

This awesome jQuery plugin is developed by rocketwagon. For more Advanced Usages, please check the demo page or visit the official website.