Lesson 30: Creating Animation in VB6
Learn to create engaging animations using image controls, position properties, and timing techniques
Key Takeaway
Visual Basic 6 offers multiple techniques for creating animations, including image visibility toggling, position manipulation, and size modification.
Welcome to Lesson 30 of our Visual Basic 6 Tutorial! In this lesson, you'll explore various techniques to create animations in VB6. While VB6 isn't primarily designed for complex animations, with creative approaches, you can program engaging visual effects.
Animation Techniques Overview
VB6 offers several approaches for creating animations:
Visibility Toggling
Show/hide different images to create the illusion of movement
Position Manipulation
Use Left and Top properties to move objects around the form
Size Modification
Change Height and Width properties to create zoom effects
30.1 Moving Jet Animation
This animation creates the illusion of a jet plane moving in four directions (North, South, East, West) by toggling the visibility of different image controls.

Implementation Steps
1Setup Images
Place five images of a jet plane on the form in different positions
2Visibility Control
Set center image Visible=True, others Visible=False
3Movement Buttons
Create buttons to toggle visibility for each direction
Code Implementation
Private Sub cmdNorth_Click() Image1.Visible = False Image3.Visible = True Image2.Visible = False Image4.Visible = False Image5.Visible = False End Sub
Animation Preview

30.2 Command-Based Animation
This approach allows users to control animation through text commands in a textbox.

Code Implementation
Private Sub cmdExecute_Click() If Text1.Text = "n" Then Image1.Visible = False Image3.Visible = True '... (other directions similarly) ElseIf Text1.Text = "e" Then 'East movement code End If End Sub
30.3 Position-Based Animation
Manipulate the Left and Top properties of an object to create smooth movement animations.

Understanding Twips
VB6 uses twips as the default measurement unit:
- 1 twip = 1/1440 inch
- Image.Left: Distance from left border
- Image.Top: Distance from top border
Movement Code
Private Sub cmdDown_Click() Image1.Top = Image1.Top + 100 'Move down 100 twips End Sub Private Sub cmdUp_Click() Image1.Top = Image1.Top - 100 'Move up 100 twips End Sub
Position Animation Demo

30.4 Size Modification Animation
Create zoom effects by changing Height and Width properties.

Code Implementation
Private Sub cmdEnlarge_Click() Image1.Height = Image1.Height + 100 Image1.Width = Image1.Width + 100 End Sub Private Sub cmdShrink_Click() Image1.Height = Image1.Height - 100 Image1.Width = Image1.Width - 100 End Sub
Lesson Summary
In this lesson, you've learned several animation techniques in VB6:
Visibility Animation
Toggle image visibility to create movement illusions
Position Animation
Manipulate Left and Top properties for smooth movement
Size Animation
Change Height and Width for zoom effects
Command Control
Enable text-based animation control
Important Note
These techniques can be combined for more complex animations. In the next lessons, we'll explore timers for automated animations and more advanced techniques.
Next Lesson
Continue your VB6 journey with Lesson 31: Animation Techniques Part 2.
Related Resources

Visual Basic 6 Made Easy
The comprehensive guide to mastering VB6 development, including animation techniques and graphics programming.
What You'll Learn:
- Animation fundamentals
- Graphics manipulation
- Practical animation examples
- Game development concepts
- Visual effects techniques

Visual Basic 2022 Made Easy
The modern guide to VB.NET programming with Visual Studio 2022. Master modern animation and graphics techniques.
What You'll Learn:
- Modern animation techniques
- WPF animations
- Game development with VB.NET
- Advanced visual effects
- Professional UI animations