Jump to content

Move Mouse on Circle


SaruzzU
 Share

Recommended Posts

And here is my version:

#include <Math.au3>

moveMouseCircle(@DesktopWidth / 2, @DesktopHeight / 2, 100, 0, 90, 10, 1)

moveMouseCircle(@DesktopWidth / 2, @DesktopHeight / 2, 100, 1, 90, 10, 5)

Func moveMouseCircle($h, $k, $radius, $direction = 0, $startangle = 0, $delay = 10, $step = 1)
    ;h = Center X
    ;k = Center Y
    ;radius in pixels
    ;direction: 0 = clockwise (default), 1 = counter-clockwise
    ;start angle in degrees (0-360): default is 0
    ;delay in milliseconds: default 10
    ;step in degrees: default 0
    
    $pi = 3.14159265358979
    
    If $direction Then
        $startangle = 360 - $startangle
    EndIf
    
    $start = $startangle
    $end = 360    
    
    For $Z = 1 to 2
        For $A = $start to $end Step $step
            If $direction Then
                $X = $h - sin(_Radian($A)) * $radius        
            Else
                $X = $h + sin(_Radian($A)) * $radius    
            EndIf
            $Y = $k - cos(_Radian($A)) * $radius
            MouseMove ( $X, $Y, 0)
            Sleep($delay)
        Next
        $start = 0
        $end = $startangle        
    Next
    
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...