Recitation 6 Object Dancers
I used the creature Optimus Prime I created last time as my dancer and added more moves including the transforming process I designed last time.
the link the project is here: https://editor.p5js.org/zzrrqqq/sketches/ZmieIzvWA
When doing the coding, I encounter two difficulties, the first one is where to use the property “this.” and were not to use that, after checking the previous example codes and the instruction of p5, I think for new functions created within the class, there’s no need to add the “this.”, otherwise, “this.” is needed.
Another problem is about the animation, since it should be totally automatic and it should be able to both do a motion and the reverse. So I added another variable to indicate what status is my dancer in right now to decide what step to take next then I don’t need to add more parameters to accomplish that.
here’s the link to the demo video https://youtube.com/shorts/vyFotL4d5vo?feature=share
Reflection:
1. Containing everything within the class makes it easier to combine codes together without making changes, it also make the code much more clear when we need to create more than one class.
2.We need to consider the size of what we are drawing, also, if we know what other’s drawings are like, we need to consider the style, the color and the pace of dancing together with other factors to make the picture harmonious with others’
3.For example, for my dancer, whose legs look the same, then modularity can enable me to use the same code for several times for the repeated work. Making movement and drawing separate enables me to change the things I want to change without influencing others, for example, I can simply change the parameter with in the move module to change the speed of the animation, if it’s not modularized, then I need to modify every function with the variable in the code to change the speed. Also, I can create different animations with the same character without writing the same display code for one more time.