如何实现鼠标在屏幕上两点移动时的抛物线轨迹
请教如何实现鼠标在屏幕上的两点(x0,y0)到(x1,y1)之间移动时的抛物线轨迹,其中暂以(x0,y0)为抛物线的顶点,抛物线的开口向左、右、上、下均可,当然若 x0=x1 或 y0=y1 则做水平或垂直方向上的直线移动(轨迹) 烦请autoit高手帮忙想想辙 2点能形成抛物线? 2点永远是一线吧. (y1-y0)/(x1-x0)是斜率. 可能没懂你的意思.你先用2点画个抛物线给大家看看.也许知道你说的是什么 函数图象吗好办的很 我也想知道! mousemov有速度控制啊 只要不是0就有轨迹啊 貌似不是很难吧 #include <Math.au3>#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $hGUI, $hWnd, $hGraphic, $hBrush, $hAsymPen, $hFormat, $hFamily, $hFont, $tLayout, $hPen
Local $aPoint, $aPoint2, $j = 1
; 创建界面
$hGUI = GUICreate("Parabola", 400, 300)
$hWnd = WinGetHandle("Parabola")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 8, 2)
$tLayout = _GDIPlus_RectFCreate(200, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, 'O(0,0)', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(20, 20, 200, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(100, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '-1', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(300, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '1', $hFont, $tLayout, $hFormat, $hBrush)
$hPen = _GDIPlus_PenCreate()
_GDIPlus_GraphicsDrawLine($hGraphic, 0, 150, 400, 150, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 200, 0, 200, 300, $hPen)
$hAsymPen = _GDIPlus_PenCreate()
_GDIPlus_PenSetDashStyle($hAsymPen, $GDIP_DASHSTYLEDASH)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 0, 100, 300, $hAsymPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 300, 0, 300, 300, $hAsymPen)
$aPoint = 200
$aPoint2 = 200
For $i = 0 To 200 Step 1
$aPoint[$j] = $i * 2 + 200
$aPoint[$j] = 150 - Sqrt($i * 2)
$aPoint2[$j] = $i * 2 + 200
$aPoint2[$j] = 150 + Sqrt($i * 2)
$j += 1
Next
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint)
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint2)
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; 清除资源
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hAsymPen)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>_Main
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $hGUI, $hWnd, $hGraphic, $hBrush, $hAsymPen, $hFormat, $hFamily, $hFont, $tLayout, $hPen
Local $aPoint, $aPoint2, $j = 1
; 创建界面
$hGUI = GUICreate("Parabola", 400, 300)
$hWnd = WinGetHandle("Parabola")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 8, 2)
$tLayout = _GDIPlus_RectFCreate(200, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, 'O(0,0)', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(20, 20, 200, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(100, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '-1', $hFont, $tLayout, $hFormat, $hBrush)
$tLayout = _GDIPlus_RectFCreate(300, 150, 50, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, '1', $hFont, $tLayout, $hFormat, $hBrush)
$hPen = _GDIPlus_PenCreate()
_GDIPlus_GraphicsDrawLine($hGraphic, 0, 150, 400, 150, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 200, 0, 200, 300, $hPen)
$hAsymPen = _GDIPlus_PenCreate()
_GDIPlus_PenSetDashStyle($hAsymPen, $GDIP_DASHSTYLEDASH)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 0, 100, 300, $hAsymPen)
_GDIPlus_GraphicsDrawLine($hGraphic, 300, 0, 300, 300, $hAsymPen)
$aPoint = 200
$aPoint2 = 200
For $i = 0 To 200 Step 1
$aPoint[$j] = $i * 2 + 200
$aPoint[$j] = 150 - Sqrt($i * 2)
$aPoint2[$j] = $i * 2 + 200
$aPoint2[$j] = 150 + Sqrt($i * 2)
$j += 1
Next
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint)
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoint2)
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; 清除资源
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hAsymPen)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>_Main
页:
[1]