Examples / p5.js Examples / / Loopers

Loopers

example p5.js javascript creating-classes trigonometry genuary

Click here to view this code in the p5 editor.

Click here to view the result by itself.

This sketch shows lines that loop around the screen.

I created this for the 20th day of Genuary which had a prompt of “No loops.” I decided to completely disobey the prompt and go in the opposite direction: yes loops!

loopers loopers loopers loopers loopers loopers

Remix Ideas

  • Change the number of loops, the chances that a line goes into a loop, or how each line moves.
  • These lines all move to the right when they aren’t looping. Make them follow the mouse instead.
  • Let the user add new loopers by dragging the mouse.

Comments and Questions

Happy Coding is a community of folks just like you learning about coding.
Do you have a comment or question? Post it here!