For this principles of animation exercise, I tried to show the principles of slowing in and out as well as squashing and stretching by animating a bouncing ball. The ball bounces in the x direction from side to side – as it gets closer to the center, it speeds up and becomes thinner (squashed); as it moves towards the other side, it slows down and goes back to normal size. This is the opposite when the direction is reversed. I actually had a lot of trouble creating this animation – I was trying to emulate some of the concepts from my lecture notes, but I kept running into obstacles. The slowing in/out wasn’t too hard to figure out, once I realized I had to create a variable for speed and add to it when the ball got closer to the center, and subtract from it when the ball moved away. I had the most problems with the squashing. I knew I had to create a variable for the squash and set it as the width of the ellipse, which wasn’t too hard. But when I added the variable into my if statements, the ball kept growing and didn’t stop. Later, I ran into a new problem where the ball would keep going faster and faster and wouldn’t slow down. Basically, to solve these problems, I just tried everything I could think of. I moved if/else statements around and tried to use different conditions for those if/else statements. Eventually, after trying many different things, I found that using a different condition for the if/else statement worked, and the ball consistently sped up and slowed down as well as squashed and unsquashed.
https://www.openprocessing.org/sketch/508591