2017-10-09 1 views
0

Ich versuche, den Mauszeiger von einem Punkt zum anderen zu bewegen. Nicht in einer geraden Linie, sondern in einer Kurve. Hier ist an illustrative video. Hier ist Code, der Maus basierend auf den Standorten bewegt:Curve Mausbewegung

func smoothmove($coords,$j,$firstms);make mouse move to the note 
    dim $currcoord[3] 
    dim $diff[3] 
    dim $pixelsptms[3] 
    if $j > 1 Then 
     if mod($coords[$j-1][7][1],2) = 0 Then 
     $currcoord[1] = $coords[$j-1][1][1] 
     $currcoord[2] = $coords[$j-1][2][1] 
     Else 
     $currcoord[1] = $coords[$j-1][1][$coords[$j-1][1][0]] 
     $currcoord[2] = $coords[$j-1][2][$coords[$j-1][2][0]] 
     EndIf 
    Else 
     $currcoord[1] = mousegetpos(0) 
     $currcoord[2] = mousegetpos(1) 
    EndIf 
    if $coords[$j][1][1] = $currcoord[1] then 
     if $coords[$j][2][1] = $currcoord[2] then return 1 
    EndIf 
    if $coords[$j][3][1] <= $firstms then return 1 
    $diff[1] = $coords[$j][1][1] - $currcoord[1] 
    $diff[2] = $coords[$j][2][1] - $currcoord[2] 
    $pixelsptms[1] = ($diff[1]/($coords[$j][3][1]-$firstms)) * 12 
    $pixelsptms[2] = ($diff[2]/($coords[$j][3][1]-$firstms)) * 12 
    dim $ready[5] 
    $ready[1] = 2 
    $ready[2] = 3 
    $ready[3] = 2 
    $ready[4] = 3 
    $firstms += 12 
    $count = 0 
    while 1 
     DllCall($osumap[0], 'int', 'ReadProcessMemory', 'int', $osumap[1], 'int', $address[2], 'ptr', $bufferptr, 'int', $buffersize, 'int', '') 
     $ms = DllStructGetData($buffer,1) 
     if $ms >= $coords[$j][3][1] Then return 1 
     if $pixelsptms[1] < 0 Then 
     if $currcoord[1] <= $coords[$j][1][1] Then 
      $currcoord[1] = $coords[$j][1][1] 
      $ready[3] = 1 
      $pixelsptms[1] = 0 
     EndIf 
     Else 
     if $currcoord[1] >= $coords[$j][1][1] Then 
      $currcoord[1] = $coords[$j][1][1] 
      $ready[3] = 1 
      $pixelsptms[1] = 0 
     EndIf 
     EndIf 
     if $pixelsptms[2] < 0 then 
     if $currcoord[2] <= $coords[$j][2][1] Then 
      $currcoord[2] = $coords[$j][2][1] 
      $ready[4] = 1 
      $pixelsptms[2] = 0 
     EndIf 
     Else 
     if $currcoord[2] >= $coords[$j][2][1] Then 
      $currcoord[2] = $coords[$j][2][1] 
      $ready[4] = 1 
      $pixelsptms[2] = 0 
     EndIf 
     EndIf 
     if $ready[3] = $ready[4] Then return -1 
     if $ms >= $firstms Then 
     $currcoord[1] += $pixelsptms[1] 
     $currcoord[2] += $pixelsptms[2] 
     $firstms += 12 

     mousemove($currcoord[1],$currcoord[2],0) 

     EndIf 
    WEnd 
EndFunc 

Antwort

2

Vielleicht gibt Ihnen das einige Ideen.

#include <math.au3> 
HotKeySet("{ESC}", "esc") 
Global Const $PI = 3.1415926535897932384626433832795 
Dim $t 
Dim $expr 
For $theta = 0 To 924 * $PI ;ALSO MAKE THE LOOP GO LONGER 
    $t = _Radian($theta) 
    $expr = Exp(Cos($t)) - 2 * Cos(4 * $t) - Sin($t/12)^5 
    $x = 400 + 100 * Cos($t) * $expr 
    $y = 400 + 100 * Sin($t) * $expr 
    ConsoleWrite($x & "," & $y & @LF) ;Use for debugging with SciTE 
    MouseMove($x, $y, 1) 
Next 

Func esc() 
    Exit 0 
EndFunc ;==>esc 
+0

'Global Const $ PI = ACos (-1)' – user4157124

+0

Vielen Dank Herr. Ich konnte es mit deiner Hilfe funktional machen. –

+0

@ KevinRazielexŠubr Mind [Ihre Lösung zu posten] (https://stackoverflow.com/q/47593934/4157124)? – user4157124