https://github.com/dylanpyle/raphael-sparks
A super-simple (2d) particle generator for Raphael
https://github.com/dylanpyle/raphael-sparks
Last synced: 8 months ago
JSON representation
A super-simple (2d) particle generator for Raphael
- Host: GitHub
- URL: https://github.com/dylanpyle/raphael-sparks
- Owner: dylanpyle
- Created: 2011-12-14T22:23:28.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-15T04:21:25.000Z (over 14 years ago)
- Last Synced: 2024-04-14T15:10:26.269Z (about 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 160 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# raphael-sparks
An über-simple particle generator for [Raphael.js](http://raphaeljs.com).
Very much a work in progress. Some goals include:
* Becoming a Raphael plugin rather than just a stand-alone script
* Fixing *all the bugs*. There are some.
* Transitioning size/opacity as well as just position.
Oh, also, it's really tiny. Currently <2kb compressed.
## Usage
```javascript
// Initialize
var sparks = new Sparks(paper);
// Move particle generator
sparks.move(200, 200);
// Start making new particles (e.g. on mousedown)
sparks.start();
// Stop making new particles
sparks.stop();
```
## Settings
Sparks has a few settings, such as:
* color: Particle color
* radius: Particle radius
* gravity: Particle gravity (around 1 is nice; 0 is no gravity)
* drag: Acceleration (value from 0 to 1, around 0.9 is nice)
* lifespan: How many cycles before the particles disappear. Default is 200.
Configure them as follows:
```javascript
var sparks = new Sparks(paper);
sparks.settings.color = '#eee';
sparks.settings.radius = 3;
sparks.move(150, 150);
sparks.start();
```