vb沿着曲线滚动的小球?
1个回答
展开全部
Dim y As Double
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command4_Click()
Line (-2, 0)-(10, 0) '»³öXÖá 烂数
Line (0, 3)-(0, -3) '»³öYÖá
For i = 0 To 6.28 Step 0.001
j = Sin(i)
PSet (i, j) ' »³öÕýÏÒº¯ÊýͼÏñ
Next i
End Sub
Private Sub Form_Load()
Form1.Scale (-2, 3)-(10, -3)
Form1.FillStyle 歼数= 0
Form1.FillColor = vbRed
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Static x As Double
Cls
Line (-2, 0)-(10, 0)
Line (0, 3)-(0, -3)
For i = 0 To 饥改首6.28 Step 0.001
j = Sin(i)
PSet (i, j)
Next i
x = x + 0.5
If x > 6.28 Then
x = 0
Else
y = Sin(x)
Circle (x, y), 0.2, vbRed
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询