Smooth Pixel Movements in Flash

Making Flash video games that have outstanding graphic effects requires the graphics move with a smooth, even motion. This requires that you know how to move every pixel in the graphic smoothly. It is easy to move graphics and pixels in Flash. However, making them move realistically requires that you consider the dynamics of movement within a digital environment and use the appropriate Flash program features.
  1. Setting the Time Interval

    • Use the Flash timer object (class) to trigger the movement of a pixel at a predefined timing intervals. Set the timer to move the pixel at time intervals in the order of 1/100 second (corresponding to a frame rate of 100 frames per second) to create the illusion of continuous motion.

    Setting the Distance Inverval

    • Place the position code in the function that the timer event object calls for such that the pixel will move once for every timer event occurrence (1/100 second). Set the distance the pixel will move for each timer event as small as possible for your application. Adjust the minimum distance and the minimum time interval (timer event occurrence) so that the smoothest pixel movement is obtained.

    Pixel Speed

    • Pixels moving at low speeds, less than 2 inches per second, move with a more continuous and smoother motion than pixels that move at higher speeds as long as the distance interval is set in the order of 1 pixel and the time interval (frame rate) is set at, or above, 10 milliseconds. As the pixel speed increases, the pixel motion tends to become choppier.

    Pixel Compensation

    • Add semitransparent pixels that follow the pixel you are moving (the lead pixel) as the speed of the pixel increases. Adjust the transparency of these trailing pixels so the trailing pixels fades every time the leading pixel moves. Adjust the number, the movement and transparency level of the trailing pixels so that the lead pixel and the trailing pixels appear as one pixel moving with a continuous motion. Adjust the rate at which the trailing pixels fade to further optimize the illusion of one smooth pixel movement.

    Flash Compensation

    • Set the Flash parameter, cacheAsBitmap, to true, so that the pixels won't be rendered unnecessarily and to eliminate the possibility of choppiness from repeatedly rendering the pixels. Use floating point numbers to specify the position of the pixels. Use Flash blend mode properties to blend the color of the pixel movement with the background color of the computer screen to improve the illusion of continuous smooth pixel movement.

Learnify Hub © www.0685.com All Rights Reserved