Setting up a sketch in Processing
Creating an animation
Handling mouse and key events
Using variables to change state of objects
Problem-solving (the balls cross in the same time)
Some use of conditions
need to draw, and animate, two semi-transparent circles, travelling in lanes, that cross each other in the centre of the display window. it should reset the balls when the mouse is pressed and update speeds using UP and DOWN arrow keys. Pressing the UP key results in doubling of speed and pressing the DOWN key results in halving of speed.
display the correct background (hexadecimal color code is #C8F5F2),
set the display window size to 600 pixels wide and 400 pixels high,
configure the lanes so that both lanes are white, the width of the vertical lane is one eighth of the width of the display window, and the height of the horizontal lane is one eighth of the height of the display window.
ensure diameters of the balls are 80% of the lane width or height and are in the middle of the lane.
the leftmost point of the green ball just touches the left wall and the topmost point of the red ball just touches the ceiling of the display window.
move the green ball horizontally from left to right and the red ball vertically from top to bottomThe two balls cross exactly in the middle of the display [login to view URL] variable names should reflect their purpose. Variable names like a, b, c, d, e, f are not recommended.
Code is well-indented.
Add one level of indentation whenever you enter a function or a conditional block.
Reduce one level of indentation whenever you exit a function or a conditional block.
Code is appropriately commented. Do not comment each line and don't add comments re-iterating the code. For example, a comment like "increase x by 1" against a statement "x=x+1;" is not recommended.
It should be in a single pdf file.