ICM Week4

This week, I got to know how to use a function that I create to organize the code.

I tried to restructure one of my old sketches, and the code is significantly much cleaner.

Specifically,  I created a function to draw a slider. This function includes two parameters: xlo and halfrect, which means the x position of the slider and the half value of the rectangle’s width.

Then I created a function to draw dots matrix, which also has two parameters: interval and size. Interval stands for the distance between each dot and the size stands for the size of dots. Besides, I need to return the value of x, because this value is used by other functions

As to the bouncing ball, I created an object which includes a series of functions.

And the outcome is the same:

Leave a Reply

Your email address will not be published. Required fields are marked *