VISUAL BASIC_6
 

7. Animation Projects


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 Form_Load()

i = 0

End Sub

 

Private Sub Timer1_Timer()

If i = 0 Then

Image5.Picture = LoadPicture

Image1.Picture = LoadPicture("c:\vbproj\juggler0.gif")

i = i + 1

ElseIf i = 1 Then

Image1.Picture = LoadPicture

Image2.Picture = LoadPicture("c:\vbproj\juggler1.gif")

i = i + 1

ElseIf i = 2 Then

Image2.Picture = LoadPicture

Image3.Picture = LoadPicture("c:\vbproj\juggler2.gif")

i = i + 1

ElseIf i = 3 Then

Image3.Picture = LoadPicture

Image4.Picture = LoadPicture("c:\vbproj\juggler3.gif")

i = i + 1

ElseIf i = 4 Then

Image4.Picture = LoadPicture

Image5.Picture = LoadPicture("c:\vbproj\juggler4.gif")

i = i + 1

Else

i = 0

End If

End Sub

 

Figure 5a 


                         Figure 5

                                          Figure 6


 

Copyright © 2001 Selfonline-Education. All rights reserved.