| Topic: Animation Control In this lesson we will consider some three projects involving animation. Animation is caused by the motion of inanimate objects. 1. Project using Animation Control: The Animation control allows you to create buttons which display animations appropriate to the function perfomed by the computer. For example, when a filecopy operation is perfomed, it will be appropriate when such a function is visually denoted by flying something from the source to the destination. In Windows 95, this function is denoted by pieces of paper flying from one folder to another folder. Drag an animation control, a Common Dialog Control and two command buttons from the Toolbox. The animation control will work only with silent avi files. Change the Caption property of command buttons as ‘play’ and ‘stop’ respectively and arrange them in the design window as shown in the figure 1. Entering the code: Open the code window by doubleclicking the command button and enter the codes as shown in the figure 1a. Private Sub Command1_Click() Private Sub Command2_Click() Figure 1a Running the Project: Select the Start button from the Run Menu. The run mode window appears on the screen. On clicking the play button, a file open dialog box appears. You will find a number of avi files in the directory given by \program files\devstudio\vb\graphics\avi\ . On selecting the file the animation display appears on the screen as shown in the figure 2.
2. Blinker Project: In this project we draw two picture boxes and two timers in the design form. Two command buttons are included to start and stop the blinking operations. The blinker design window looks as in the figure 3. The codes for the timers, form and the command buttons are entered in the code window as shown in the figure 3a. The project is saved and given the Run command. The run mode window looks as in the figure 4. On clicking the start button, the two picture boxes begin to blink one in red and another in blue colors. On clicking the stop button blinking stops. Option Explicit Private Sub Command1_Click() Private Sub Command2_Click() Private Sub Timer1_Timer() Private Sub Form_Load() Figure 3a
3. A Juggler Project: In this project a juggler will appear to be moving and at the same time juggling with three balls in his hands. Drag 5 picture boxes and one timer in the form and make the design window look as shown in the figure 5. Set the timer interval property as 100. Enter the codes as shown in the figure 5a. Save the project and bring it to the run mode. The run mode window looks as in the figure 6. You can see the juggler moving and juggling. In this project we load the picture file successively in 5 positions at short regular intervals. This gives the illusion of motion. Dim i As Integer Private Sub Timer1_Timer() Figure 5a
|