Original design and development by Victor Ivanov, with additional functionality and documentation by Michael Hemingway.
Constellation.js features a responsive canvas in html, with a set of dot objects that bounce around with constrollable spawn parameters, and once in proximity to one another, these dots are connected by lines.
Load constellation.min.js
in your document and initialize constellation to your canvas.
Constellation.setup({
canvas: document.getElementById('canvas'),
lineDistance: 100,
dotnum: 160,
interactive: true,
strokeColor: 'rgb(120,120,120)',
dotColor: 'rgb(220,220,220)'
});
Constellation.start();
The canvas will be automatically sized to its parent size.
- Corrected misleading documentation. Thanks @Ragekit!
- Added colors! One can now pass
dotColor
andstrokeColor
as parameters in rgb. Documentation has been updated to reflect this change. - This version does not work on mobile.
- Made it into a neat little module! Now with 100% more options.
- Fixed and perfected the mouse hover effect, added in logic to walk the mouse around when not active.
- Added strict statement & encapsulated the entire code in dom listener event and closure.
- Fixed fitToContainer(); method from earlier implementation which needlesly took a canvas argument.
Version 1.0.6
Last updated October 17th, 2016