Animation in Visual Basic5.0
Hi to all members.
I'm doing my thesis for undergraduate course.
I'm using PictureBox to put for example 3 pictures there. I'm using timer to change the picture. Is it possible to make the effect like 3D? what I mean is the previous picture will change slowly and the next picture will appear slowly. U can see the process of changing the picture slowly. Because what I experiencing before using timer is, the picture will change right away without seeing the process of changing picture.
Thank you.
Re: Animation in Visual Basic5.0
That should look like 3D? That's an interesting opinion.
Anyway, if you are using the same pictures all the time, you should make the "intermediate" pictures by hand and put them into the loop as well.
If the pictures can change, you would need to "process" those pictures to make it look that way. One way for this processing could be to use opacity (if that's available in VB5), but that is just a rough idea.
Re: Animation in Visual Basic5.0
Quote:
Originally Posted by opus
Anyway, if you are using the same pictures all the time, you should make the "intermediate" pictures by hand and put them into the loop as well.
What do you mean by that statement? Anyway the 3 pictures that I will be using will be totally different. The effect that I refering to is like animation in Adobe Photoshop. Could we really do that? If yes, how to do that and please show me sample codes for that.
Thank you.
Re: Animation in Visual Basic5.0
What I meant was to use something like Photoshop to make the additional pictures that are needed to show any kind of animation!
Re: Animation in Visual Basic5.0
Don't know how this can be 3D, but
If you can use direct3d in VB5 (I don't see why not) then you could do this by putting each picture in a texture, stacked in the Z-direction, and changing the alpha values on the textures to make each one more or less transparent.
You could also do it by hand. Interpolate between the R,G,B values for the two pictures.
You can read the value of a pixel in a picture box using
picBoxName.Point(x, y)
This returns a long which can be split up into R,G,B.
You can write to a pixel in a picture box using
picBoxName.PSet (x, y), color
This way would be slower and probably take more coding than direct3d.
Re: Animation in Visual Basic5.0
Is it possible to put the picture inside the PictureBox when you run the program? What I mean is not through going the properties and click the icon.
I just want the user to put by his/herself the picture. If yes, what is the code to doing that?
Re: Animation in Visual Basic5.0
You use LoadPicture, eg:
Code:
Set picBoxName.Picture = LoadPicture("c:\folder\picture.jpg")
Re: Animation in Visual Basic5.0
What I mean is the user will insert the picture by his/herself? If the case is we already have the picture, we can do that. But how about if the user just added the picture to the computer and he/she want to put the picture when the program is running?
Assume that the user is only using the program. I as a programmer want to make a code where the user can put any picture that he/she like eventhough they insert a new picture that they just added.
I hope you get my point.
Thanks.
Re: Animation in Visual Basic5.0
If you want the user to select a file, use a CommonDialog.
There is a tutorial on it (which is listed in our FAQs as "How can I show an "Open" or "Save" dialog?") here.
Ignore the "To Save" parts, and you only want the first 5 lines of the "To Load" example.
Re: Animation in Visual Basic5.0
The code is for text, how about for picture, what code should I use?
Re: Animation in Visual Basic5.0
The code is for selecting a file to open (which is stored to the FileName variable).. lines 9 to 12 are for opening a text based file, so replace them with appropriate code for loading the type of file you want (like I posted in this thread).
You will probably want to change the .Filter line, but you can work out how to do that from the help (just click on Filter in the code, then press F1).