LMU ☀️ CMSI 185
COMPUTER PROGRAMMING
HOMEWORK #1 PARTIAL ANSWERS

Programming Problems

  1. To make the circle go from as wide as the canvas to nothing in exactly five seconds, we have to set the frame rate and base our shrinking interval from that. Of course, that was probably very tough to discover, but I was allocating just one point for it, benefitting those that thought to look it up or ask! Here’s my solution:

    The frame rate computations I did ensure that no matter the starting width, the circle takes five seconds to shrink. Without knowing about the frame rate, you could have taken a best guess and hard-coded the diameter change. Regardless of your approach, starting at the canvas width and turning off the animation loop were absolutely required. Remember that if you don't call noLoop your browser is performing unnecessary computation by rendering the same frames over and over again.

  2. Here is my boring plane landing animation. For fun, I used JavaScript objects, which I didn’t have to, but things are better that way. Note that I put a lot of care into doing “configuration” at the top of file. There are so many fun settings to play with. I also used the transformation matrix, which wasn’t part of your reading, but it’s good to know about, too. Always a good day to learn new things.