-
Notifications
You must be signed in to change notification settings - Fork 71
/
RandBezier.ahk
41 lines (41 loc) · 1.45 KB
/
RandBezier.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
RandomBezier( X0, Y0, Xf, Yf, O="" ) {
Time := RegExMatch(O,"i)T(\d+)",M)&&(M1>0)? M1: 200
RO := InStr(O,"RO",0) , RD := InStr(O,"RD",0)
N:=!RegExMatch(O,"i)P(\d+)(-(\d+))?",M)||(M1<2)? 2: (M1>19)? 19: M1
If ((M:=(M3!="")? ((M3<2)? 2: ((M3>19)? 19: M3)): ((M1=="")? 5: ""))!="")
Random, N, %N%, %M%
OfT:=RegExMatch(O,"i)OT(-?\d+)",M)? M1: 100, OfB:=RegExMatch(O,"i)OB(-?\d+)",M)? M1: 100
OfL:=RegExMatch(O,"i)OL(-?\d+)",M)? M1: 100, OfR:=RegExMatch(O,"i)OR(-?\d+)",M)? M1: 100
MouseGetPos, XM, YM
If ( RO )
X0 += XM, Y0 += YM
If ( RD )
Xf += XM, Yf += YM
If ( X0 < Xf )
sX := X0-OfL, bX := Xf+OfR
Else
sX := Xf-OfL, bX := X0+OfR
If ( Y0 < Yf )
sY := Y0-OfT, bY := Yf+OfB
Else
sY := Yf-OfT, bY := Y0+OfB
Loop, % (--N)-1 {
Random, X%A_Index%, %sX%, %bX%
Random, Y%A_Index%, %sY%, %bY%
}
X%N% := Xf, Y%N% := Yf, E := ( I := A_TickCount ) + Time
While ( A_TickCount < E ) {
U := 1 - (T := (A_TickCount-I)/Time)
Loop, % N + 1 + (X := Y := 0) {
Loop, % Idx := A_Index - (F1 := F2 := F3 := 1)
F2 *= A_Index, F1 *= A_Index
Loop, % D := N-Idx
F3 *= A_Index, F1 *= A_Index+Idx
M:=(F1/(F2*F3))*((T+0.000001)**Idx)*((U-0.000001)**D), X+=M*X%Idx%, Y+=M*Y%Idx%
}
MouseMove, %X%, %Y%, 0
Sleep, 1
}
MouseMove, X%N%, Y%N%, 0
Return N+1
}