Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AngleLine(src, dst: TPoint; stepfactor:Double): TPointArray;
- var
- i,steps: Int32;
- delta: TPoint;
- x,y,xstep,ystep: Double;
- begin
- delta.x := dst.x-src.x;
- delta.y := dst.y-src.y;
- if delta.y > 180 then delta.y -= 360;
- if delta.y < -180 then delta.y += 360;
- steps := Trunc(Sqrt(Sqr(delta.x) - Sqr(delta.y)) * stepfactor);
- if steps = 0 then Exit([dst]);
- xstep := delta.x / steps;
- ystep := delta.y / steps;
- SetLength(Result, steps);
- for i:=0 to steps-1 do
- begin
- x += xstep;
- y += ystep;
- Result[i] := [Round(src.x+x), Round(src.y+y)];
- end;
- end;
- procedure SlideMouse(Pt: TPoint; InverseSpeed: Int32=1; stepfactor: Double=0.1);
- var
- i: Int32;
- p,q: TPoint;
- TPA: TPointArray;
- begin
- GetMousePos(p.x,p.y);
- TPA := AngleLine(p,q, stepfactor);
- for i:=0 to High(TPA) do
- begin
- MoveMouse(TPA[i].x, TPA[i].y);
- Sleep(InverseSpeed);
- end;
- end;
- begin
- SlideMouse([100,100],1,0.1);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement