Lab 8.2 - Screen Saver

Screensaver

Screen savers were invented to avoid the hazard of "screen burn-in" that would happen when the phosphors on a screen were activated for too long, and an image would be burned into the monitor. Things have progressed since then, and monitors no longer suffer from burn-in, but screen savers are still pretty and popular.

Create a screen saver that takes two different LineShapes and moves them around the screen by modifying the values of the Properties that define the two endpoints (X1, Y1, X2, and Y2). Each LineShape should start in a random location and each endpoint should start moving in a random perfectly diagonal direction, preferably at different speeds.

When an endpoint encounters the edge of the Form (regardless of the Form's size), it should "bounce" off of that edge, reversing either in the X or Y direction (as appropriate). Your program should have a way for the lines to get back to the ClientSize if the Form is resized. The endpoints do not have to bounce off the other LineShape.

HINTS: Use a pair of variables for each point: one to track the horizontal speed, one to track the vertical. Obviously, you should use a timer.

BONUS: Come up with something more creative than moving around a line. It has to be animated, have some sort of mathematical principle involved (like the changing direction above), and at least mildly visually interesting. For more extra credit, either add or change one or more of the objects moving about on the screen.

As always, design a useful and proper interface. You don't need a Done button for this one.