January 20, 2021

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.

Creating Classes Examples


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

Comments are powered by the Happy Coding forum. This page has a corresponding forum post, and replies to that post show up as comments here. Click the button above to go to the forum to post a comment!