Project Title: little CD player
Link to my project: https://editor.p5js.org/sf3972/sketches/H2yWjowz5
Brief Description and Concept:
Here is my imaginary creature, a cute little CD player! She is enjoying her music. For this project, you can see that I used arrays and the random function to create tens of music notes coming out of the player. Additionally, I tried to use user-defined functions for each part of my cd player to manipulate their sizes, positions, and rotating directions, which was super fun to explore. And I also used the if statement to control the waving of the cd’s arms. Come and flow yourself into the music together!
Demo/Visual Documentation:
Coding:
I wanted to add some animation to my creature, so I tried to figure out how to make the light rotate around the middle part so it looked like the cd was playing. However, the light just rotated by itself when I added a variable(x1=x1+1). I turned to Marcele and she told me that switching to frame count would let me get an ever-updating number. I adjusted the parameter of rotate into frameCount*0.01 and it worked just fine.
Reflection/Lessons Learned
Describe what values were stored in the array(s) and how you utilized them. Share your experience while using the array(s).
The number of the music notes is stored in my array. I adjusted the number, the speed, and the location where they emerge. In addition, I used the random function for the speed, so the flow of the notes would seem to be more natural.
Explain when/why translate(), push() and pop().
In an attempt to change an object’s position within a function, we use translate() so that we can adjust the center point of the object. And we use push() and pop() so that the adjustment wouldn’t affect objects in other functions
What is the effectiveness of User-Defined Functions?
User-defined functions make it easier to redefine them and change parameters each time so that the productivity of coding would increase and the interface looks tidier and more intuitive.
What parameters did you add to your functions? How were they manipulate the effects of the functions?
The location, the size, and the rotating direction. Their rough parameters were set when creating the function, and after using translate(), I could adjust them within the functions further.
Are you able to identify methods/processes in your programming that are radically changed because of the uses of the functions you defined?
It becomes much easier to relocate and spot things!