VB中圆运动的制作(用timer控件)

来源:百度知道 编辑:UC知道 时间:2024/05/16 10:11:44
想做出三个圆慢慢运动的效果,三个圆交合后又一起运动到最右端
期盼高手指点
Private Sub Form_click()
Form2.ScaleMode = 6
Form2.Scale (-100, 100)-(100, -100)
DrawWidth = 25
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
a = -80
b = 88
c = -80
d = 78
e = -80
f = -83
b = b - 1
c = c + 1
d = d - 1
e = e + 1
f = f + 1
Form2.Circle (a, b), 3, vbBlue
Form2.Circle (c, d), 3, vbBlue
Form2.Circle (e, f), 3, vbRed
Timer1 = True
End Sub
Private Sub Timer1_Timer()
Cls
Form2.Circle (a, b), 3, vbBlue
Form2.Circle (c, d), 3, vbBlue
Form2.Circle (e, f), 3, vbRed
End Sub
想做出三个圆慢慢运动的效果,三个圆交合后又一起运动到最右端
期盼高手指点

Option Explicit
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
Private Sub Form_click()
Form2.ScaleMode = 6
Form2.Scale (-100, 100)-(100, -100)
DrawWidth = 25
a = -80
b = 88
c = -80
d = 78
e = -80
f = -83
Form2.Circle (a, b), 3, vbBlue
Form2.Circle (c, d), 3, vbBlue
Form2.Circle (e, f), 3, vbRed
Timer1 = True
End Sub

Private Sub Timer1_Timer()
Cls
a = a + 1
c = c + 1
e = e + 1
If b <= -2 Then
b = b
Else
b = b - 1
End If
If f >= 2 Or d <= -2 Then
d = d
f = f
Else
d = d - 1
f = f + 1
End If
Form2.Circle (a, b), 3, vbBlue
Form2.Circle (c, d), 3, vbBlue
Form2.Circle (e, f), 3, vbRed
End Sub