A customizable, animated background featuring floating squares
Adapted from design by Mohammad Abdul Mohaiman at https://codepen.io/mohaiman/pen/MQqMyo
import SquaresBG from "react-animated-squares";
<div id="container">
<SquaresBG count={20} speed={0.7} />
</div>To install: npm i react-animated-squares
Place <SquaresBG /> as first child in parent element, and place contents as subsequent elements. BG will fill any parent with a defined width and height. Parent should have CSS rule overflow: hidden
All props are optional and can be undefined.
Number of animated squares to render
Speed at which squares rise. A number between 0 and 1, inclusive. Higher is faster
Minimum size of squares, in pixels
Maximum size of squares, in pixels
Color of background
Color of squares, with 0.2 alpha value by default. Must be 6 character hex, rgb, or rgba
Renders a random background color, overrides backgroundColor
Renders a random square color for each square, overrides squareColor
