Recitation Exercise
I chose to develop my work from the last recitation. I wanted to make the pattern move endlessly, so I used the ‘%’ function to make the translation smooth. The translation part was easy, but the pattern sometimes appeared suddenly instead of smoothly. It took me the entire class to figure out what went wrong and finally, I realized it was the range of the pattern. To be more specific, the pattern did not cover the moving range. So, I modified the data and made the canvas smaller.
This is my code.
Recitation Homework
The only difficulty I ran into was that when I was making the canvas’ edges into a border, I wanted to take the size of the circle into the consideration as well. To be more specific, I wanted that when a circle is approaching the border, its size at the second it touches the border would be its maximum size when remaining at that position. I tried a lot of methods, including changing the maximum when hit the border, but I found that the size of the circle has to change constantly and the border could not limit the size of the circle. So, I just made the border into a fixed one that can contain the maximum size of the circle.
This is my code.