for this week we built an animation of a moving circle
the critical thing about this week’s coding is to set a changing variable ad st it to be relevant to the color and the radius of the circle.
one thing i notices about the example is that when it reaches the biggest and smallest radius, the speed of radius change seems to slow down a bit. so i decided that the changing variable should be sin(another changing variable).
so after calibration it should be:
stroke((sin(i)+1)*127.5, 255, 255);
size = (sin(i)+1.1)*272;
while i is a variable that increses by 0.05 in each draw loop.
another thing i learned is that keyPressed() is a built in function that don’t need to be called in the draw() function, and also if the key is coded, i have to put keyCode == ??? or it won’t work.
if i had more time i could finish the bonus point. the logic would be: if the distance between the center of the circle and the border <=the radius, reset the center so that its distance to the border equals to the current radius.
final version: