This is a p5.js script I started played with as I get ready to post about stop animation in my 52 weeks of hands-on-math. Here is a link to edit code. You may want to play with the angles, number of sides in the polygon, rotation rate, etc.
I used the polygon function from this website: https://stephanmax.is/writing/generative-art-with-p5js. It references this series of videos to make generative art:https://www.youtube.com/playlist?list=PLyRZnpOSgMj3K8AV2I6UldnvTj6d_Zrf0