A JavaScript plugin for figures out of strange moving particles. This includes an optional force field generated by the mouse pointer or your fingers on the touch pad which lets the particles push away. It works in any browser that supports HTML5 canvas.
var element = document.getElementById('your-element');
var strangeOrbits = new StrangeOrbits(element);
StrangeOrbits exposes methods which can be used to interact with your StrangeOrbits instance.
var element = document.getElementById('your-element');
var strangeOrbits = new StrangeOrbits(element);
strangeOrbits.start();
Starts the animation.
Stops the animation.
It lets appear a point figure using a PNG image as template. The engine considers every non-transparent pixel.
Lets disappear the current point figure.
Options can be set by passing an options object to the constructor or by setting via reference.
Here are two examples of setting the color of the particles and the background:
var strangeOrbits = new StrangeOrbits(element, {
color: 'orange',
backgroundColor: '#080808'
});
and
var strangeOrbits = new StrangeOrbits(element);
strangeOrbits.options.color = 'orange';
strangeOrbits.options.backgroundColor = '#080808';
Here is a full list of options, and their default values:
#FFFFFF
Sets the color of the particles.
#080808
Sets the color of the background.
0.0075
Sets the density of the particles. The number represents the probability of a non-transparent pixel to become a particle.
1
Sets the minimum particle radius.
3
Sets the maximum particle radius.
0.15
Sets the minimum particle opacity.
0.85
Sets the maximum particle opacity.
10
Sets the minimum tremble offset of the particles.
20
Sets the maximum tremble offset of the particles.
250
Sets the minimum travel time for trembles of the particles.
750
Sets the maximum travel time for trembles of the particles.
true
Activates the point force field (mouse or touch).
60
Sets the point force field radius.
true
Activates the point force field boost while holding the mouse button pressed.
70
Sets the boosted point force field radius.
{
'ease': new BezierEasing(0.25, 0.1, 0.25, 1.0),
'linear': new BezierEasing(0.00, 0.0, 1.00, 1.0),
'ease-in': new BezierEasing(0.42, 0.0, 1.00, 1.0),
'ease-out': new BezierEasing(0.00, 0.0, 0.58, 1.0),
'ease-in-out': new BezierEasing(0.42, 0.0, 0.58, 1.0),
'strange': new BezierEasing(0.7, 0, 0.3, 1)
}
Defines a list of easings defined with a Bézier curve. You can add new BezierEasings in this list. Click here to get more informations about BezierEasing.