setup Fill Pixels( )
The setup Fill Pixels() static method is used to ensure that the fill pixel array is initialized-and is at as long as one whole line (or this applet. If this array has not -been initialized yet or is not long enough for this applet, then this method respectively re-creates or creates and fills in the array. If there is more than one instance of this applet running, both can share this fill_pixels array, but it must be at least as long as the widest applet,
The init( ) method for this transition starts like all other transitions, with a call to the base class’ init() method. It follows this witha call to themethod described earlier, sctupFillPixcls( ). The initial values of the drop amount and location variables are then calculated. After this, the init() method goes into a loop to create each frame. It actually docs this in reverse, creating the last frame first. It does not have to be done in reverse. However, running loops in reverse saves one byte of code in the resulting-class file. After each cell is created, the location variable is incremented to the next proper location.
The Smashl ) method modifies the work_pixels array for the next cell. It creates the smashed image of the old billboard in the work_pixels array and draws in the pixels: for the new image. This method jakes one parameter, max_fold, which is used as the – maximum right offset that the lines in the fold will have. It is also used by subtracting”this from the line width to determine the length of the lines to draw for the folds. The method begins by copying the pixels from the new image onto work pixels. It then initializes a number of variables that it uses to draw the smashed’ image. The drawing of this smashed image is done ‘line by line; in a loop, Within the loop, it first ::: makes the current line totally white, It then copies a portion of the correct Iirc’ from tlie old billboard over this line. To get the accordion effect, it does not start drawing onto the same pixel location as it did for drawing the white line.Ttin stead offsets the destination pixels to the right by a few pixels, After in the line, it add number to the offset counter. It follows this with a bounds check to see if the offset has’ gone (‘ beyond the minimum or maximum offset: If it has, it flips the sign of the’ number .;: it adds to the offset counter each line. The effect of this is that the direction of the offset is reversed.