In an animation an object is repeatedly loaded at successive places across the screen so it appears to move. You can use a timer to control the animation speed.
Set up a form like this:
![]()
(Here is a car image that you can copy and save)

The timer controls the speed of the car - it is not visible when the application runs. Set the following properties for tmrSpeed:
-
enabled = False (You don't want the timer to run until start is clicked)
-
interval = 20
Here is the code you will need:
| Private Sub cmdStart_Click() imgCar.Left = 50 'put the car back to the start tmrSpeed.Enabled = True 'start the timer End Sub Private Sub cmdStop_Click() tmrSpeed.Enabled = False 'stop the timer End Sub Private Sub tmrSpeed_Timer() imgCar.Left = imgCar.Left + 30 'move the picture across 30 End Sub |
|
|
Test your Application
Test your application and make any necessary modifications. Adjust the timer control settings until the car moves at the speed you want it to.
You can create a background for your animation by setting the picture property for the form. (You may wish to draw a background in a paint program first)
![]() |
|






