Ok, I need help with Visual basics, who would have ever thought? lol

WarDemon666

Platinum Member
Nov 28, 2000
2,224
0
0
Ok, im trying to make a little animation to improve my program... but its choppy! i cant seem to get a smooth animation..

Heres the basic code:

1 frame with pictures in it, i want to open the frame in a kinda rolling maner...

Private Sub cmdStart_Click()
Do Until fraPics.Width >= 3000
fraPics.Width = fraPics.Width + 1
DoEvents
Loop
End Sub


What are you supposed to do to make it smooth? The picture in the back flicker, it doesnt look nice at all... is there any other way?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Put in on a 20 frames/sec timer. Much faster, the human eye can not notice it. Therefore what is registering is not a smooth sequence because some frames are missing to the mind.
 

Confused

Elite Member
Nov 13, 2000
14,166
0
0
Did you set the timer interval to 20ms?


If so, you want to set it to 50ms :)

And don't put all the code you posted above in the timer, as you won't be acheiving anything. Instead just put this code in the timer:

Private Sub tmrIncreasefraPicsWidth_Timer()
If fraPics.Width <= 3000 Then
fraPics.Width = fraPics.Width + 1
Else
tmrIncreaseWidth.Enabled = False
End If

End Sub


Confused
 

WarDemon666

Platinum Member
Nov 28, 2000
2,224
0
0
its going to go up one pixel every 50 mil. sec.? thats too slow...

thats not fast enough, i saw some vb apps with animations that went from 0 to 7000 in about 3 seconds, and was very smooth, any ideas?

If i put a frame on top of the picture, with nothing it, i get the effect i want (nothing flickers)... im confused :confused:

Thanks for all the input btw