Simple Animation Example in VB

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
6 posts Page 1 of 1
Contributors
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Hi All
Here is an easy Tutorial on Simple Animation in VB.

You can use this as an Example, but of course you can make it as elaborate as you like, I am just outlining the basics here, the rest is up too you ;)

For this Example we will use.
3 Picturebox's and 3 Timers

1. Make your Pictures you are going to use all the same size ( only for this Example )
and add 3 Picturebox's to your Form, and put a picture in each Picturebox so that that each picture sits central.

2. Put the First picturebox on the Bottom and the other 2 will go on top of each other ( Centrally )

3. Make all Picturebox's =Visible=TRUE in the Properties

4. Now add 3 Timers to your form ( all are ENABLED and set the INTERVALS on all the Timers too ( 500 )

Now for the code

Form Load Code
Code: Select all
Timer2.Enabled = False
        Timer3.Enabled = False
Timer 1 Code
Code: Select all
 PictureBox3.Visible = False
        PictureBox1.Visible = True
        Timer2.Enabled = True
        Timer1.Enabled = False
Timer 2 Code
Code: Select all
  PictureBox1.Visible = False
        PictureBox2.Visible = True
        Timer3.Enabled = True
        Timer2.Enabled = False
Timer 3 Code
Code: Select all
 PictureBox2.Visible = False
        PictureBox3.Visible = True
        Timer1.Enabled = True
        Timer3.Enabled = False
These images below are used to show you an Example.
The Clouds will move across the screen when used with this code Above.
Image

And that is it, Its as Easy as that cooll;

Enjoy

Chris
Image
User avatar
CodemaN
VIP Access - Denied
VIP Access - Denied
Posts: 74
Joined: Fri Sep 18, 2009 3:18 pm

Re: Simple Animation Example in VB
CodemaN
thankssssssssssssss man!!!!!!!!!!!!!!!!11
User avatar
wrighty1986
VIP - Donator
VIP - Donator
Posts: 119
Joined: Sat Sep 12, 2009 11:55 am

Nice bit of coad mate realy easy do thanks's mate ;)
Back Aegean sorry not been on i.v just been moving.
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

Re: Simple Animation Example in VB
Nery
Instead of making 3 timers you could use the "Elseif", something like:
Code: Select all
If Picturebox1.image = balbla then
blabla 
elseif picturebox1.image = blabal2
balbla
elseif picturebox1.image = balblabla3
balbalbla
endif
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Hi Nery
A good point there cooll;
Now why didnt i think of that first :oops:

Cheers

Chris
Image
User avatar
rashaahamed123
Just Registered
Just Registered
Posts: 4
Joined: Mon Oct 24, 2011 4:33 pm

it lukz good tnx for shar'in :|
6 posts Page 1 of 1
Return to “Tutorials”