Simple script for creating animated hexagon background. Tested in Google Chrome and Mozilla Firefox only.
- Download and place hexit.js file in desired location
- Add following script tag to your document <script src="/path/to/hexit.js"></script>
- Add "hexit" style to the desired element
- Add background color property to your desired element to choose hexagons color.
- Add Z-index property with value above 0 (zero) to all elements that needs to be above background
Script creates canvas element with Z-Index 0, and absolute position. Size of the canvas being inherited from parent element.
Browser with ES6/HTML5 support.
Written in pure JS. Has no dependecies.
- You can adjust size of hexagons by changing "diam" parameter in the hexit.js file.
- You can change desired FPS by changing targetFPS parameter (Note: This will cause all animation to slow down)
- Hexagon color can be changed by adding background color property to the target element.
- Fix strange animation behiavor when window being resized
- Provide more convinient way to change parameters
- Code refactor
PRs are welcome.
molitor.konrad on gmail
This software comes under the terms of MIT License. Copyright (C) 2019 Ismail Valiev (Konrad Molitor)