本帖最后由 C.L 于 2010-4-20 22:45 编辑
很久没有做这种物理题了,算了老半天..............用了重力加速度。
效果好象还可以,呵呵~
代码:Dim $P = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
Dim $Ico = $P & '\Aut2Exe\Icons\strawberry.ico'
GUICreate('test', 350, 130)
$cIco = GUICtrlCreateIcon($Ico, -1, 100, 100)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $cIco
IcoMove ()
EndSwitch
WEnd
Func IcoMove()
For $y=100 To 1 Step -5
Circle ($y)
Next
EndFunc ;==>IcoMove
Func Circle ($times)
Local $v=0,$t,$s,$h=0,$g=9.8,$a=$times
For $t=1 To $times
$v=Round (0.15*$a/$t,2)
$s=$v*$t
$a=$a-$g
$h+=$s
If $h <= 0 Then ExitLoop
ControlMove('test', '', $cIco, Default, 100-$h)
Sleep (30)
Next
$v=0
$a=0
$h=100
For $t=1 To $times
$v=Round (0.15*$a/$t,2)
$s=$v*$t
$a=$a+$g
$h+=$s
If $h >= 100 Then ExitLoop
ControlMove('test', '', $cIco, Default, $h)
Sleep (30)
Next
EndFunc
|