Hackathon: Day 1 (Independent Learning Journey) - P5.JS
Mar showed us how to use P5.JS. We first created a square using rect(30, 20, 55, 55); Then we filled in the square and the line colour using stroke(255, 0, 0) and fill(0, 255, 0); We then created an ellipse using ellipse(mouseX, mouseY, 100, 55); The ellipse followed our mouse due to using mouseX and MouseY as values. By removing the background, when the ellipse followed my mouse it created a pattern. We then created a conditional statement that stated: if(mouseY<200) { ellipse(mouseX, mouseY, 100, 55); } else { rect(mouseX, mouseY, 100, 55); } This means that when the mouse is less than 200 on the Y-axis (halfway), the ellipse would follow the mouse, otherwise the rectangle would follow the mouse instead. I created my own conditional statement which states: if(mouseY<200) { ellipse(mouseX, mouseY, 100, 100); fill(100, 250, 100); ...