Project Title: crazy cd player
Link to my project :
https://editor.p5js.org/sf3972/sketches/BUsJS0ACs
Brief Description and Concept:
Here’s a CD player vibrating happily to the music. Unlike the last one, this one is made by class, and you can tell that it’s more exciting not only because I added more variables, but also because that it’s going to a grand party with other creatures from CCLab!
Demo/Visual Documentation:
Coding:
The other day I saw Charlie from class making a very cool cloud that could change in size (from small to big and to small again) and color every time. He told me I could use sin(frameCount) to easily achieve the effect. I used the method several times in my project this time, which was indeed very handy and visually enjoyable.
Reflection/Lessons Learned
What is the benefit of your class not relying on any code outside of its own definition?
It can be easily inserted into another sketch without multiple adjustments.
What make it challenging to write code that has to harmonize with the code other people have written?
I created several functions at first, probably influenced by the last project in which we was taught to use user-defined functions to make the sketch organized. However, soon I figured that this would never work when combined with the code written by others because there would only be update and display functions on their sketch, and the functions of myself would be undefined. So I had to move almost everything into the display function, which was a little tricky since there is no transform in between, so I needed to be very careful when adjusting objects in case that I would affect others.
Describe the terms modularity and reusability using the example of your dancer class.
By applying the update and display functions, I separated the motion and image of my creature, thus separating a complex problem into different modules, which reduced the overall complexity and saved me a lot of trouble. Since all of the coding was completed in one class, my creature can be easily reused if added to the grand party of creatures, meaning that my creature is duplicable.