top of page
  • Writer's pictureisabellerieken

Pick Up Sticks

Updated: Jan 16, 2020

P5 Editor: https://editor.p5js.org/izzy_rieken/sketches/2POEqq91O

P5 Present: https://editor.p5js.org/izzy_rieken/present/2POEqq91O


The Goal: create an object oriented program where the pieces each had a life of their own. I wanted to create a program where with each click of the mouse, a new line was drawn and would continually draw across the screen.


Steps:



Before setup, I declared the Lines array so that the object could be inserted into the array. Declaring the "linecount" as 0 in the beginning declares that there are no lines when the program first begins. I also declared randomColor to be used later in the display function. In setup, I used "frameRate" to change the speed of the animation.


In this class, I only needed x, y and the directions of both x and y. Under display, i included the line objects and the random color generator.


Issues: Originally, I wanted the lines to draw across the screen in a random direction from a random position. However, in my code, I couldn't figure out how to make them stop redrawing with each frame rather than staying in one position.


38 views0 comments

Recent Posts

See All

Original Editor: https://editor.p5js.org/izzy_rieken/sketches/2POEqq91O New Editor: https://editor.p5js.org/izzy_rieken/sketches/K2L01Qmlq New Present: https://editor.p5js.org/izzy_rieken/present/K2L0

bottom of page