This is a simple representation of Fourier series using p5.js library.
Simply open up index.html on any browser.
You can adjust following variables in index.js file to generate different waves.
let main_radius = 100;
let dot_radius = 5;
let circles = 20;
Increasing the circle count will give you a smooth square wave