The Smash Transition class changes one image into another by dropping the new image onto the old one. The old image appears to crumble under the weight of the hew image. Two instance variables, drop_amount and location, are used to create the frames; The location variable keeps track of the pixel that the smashed image starts on. The drop_amount variable stores the number of pixels of the new image to drop onto the smashed image every frame. In other words, it is the number 10 add to the location variable each frame, A static array called fill_pixels is used to color a whole line of the work_pixels array white.
The smash effect is done by drawing the old image in an accordion-like fashion, It starts out by drawing the first lines of the old image offset to the right. Each progressive line.is offset a little bit more to the right. This continues until some maximum left offset is reached. At this point, the offset is reduced every line until an offset of zero is reached. This continues until all of the lines of the smashed image are drawn.
It does not draw the lines)rom the old image in their entirety.It uses a length that is a bit shorter than the actual length. The number of lines to draw for the smashed image decreases each frame as the old billboard becomes more and more compacted. This transition uses lines that arc evenly distributed across the old image. This ensures that the smashed image does not appear to be falling off the bottom of the applet or sliding under the new image.