Commit 60bf6bc9 authored by huangziyu's avatar huangziyu

1

parent b9e730ec
...@@ -107,8 +107,8 @@ class SlideUtils: ...@@ -107,8 +107,8 @@ class SlideUtils:
""" """
使用pyautogui实现滑块并自定义轨迹方程 使用pyautogui实现滑块并自定义轨迹方程
""" """
print(f"睡眠2.5秒后点击移动") print(f"睡眠0.5秒后点击移动")
time.sleep(2.5) time.sleep(0.5)
xx = x + offset + offset_increase xx = x + offset + offset_increase
pyautogui.moveTo(x, y, duration=0.1) pyautogui.moveTo(x, y, duration=0.1)
pyautogui.mouseDown() pyautogui.mouseDown()
...@@ -116,27 +116,8 @@ class SlideUtils: ...@@ -116,27 +116,8 @@ class SlideUtils:
pyautogui.moveTo(x + int(offset * random.randint(15, 23) / 20), y, duration=0.28) pyautogui.moveTo(x + int(offset * random.randint(15, 23) / 20), y, duration=0.28)
y += random.randint(-9, 0) y += random.randint(-9, 0)
pyautogui.moveTo(x + int(offset * random.randint(17, 21) / 20), y, duration=random.randint(20, 31) / 100) pyautogui.moveTo(x + int(offset * random.randint(17, 21) / 20), y, duration=random.randint(20, 31) / 100)
y += random.randint(-3, 3) y += random.randint(0, 8)
pyautogui.moveTo(xx, y, duration=0.8) pyautogui.moveTo(xx, y, duration=1.5)
print("睡眠1秒后松开")
time.sleep(0.2)
import math
move_range = 15
while_count = 0
while while_count< 3:
while_count +=1
move_x = random.randint(-move_range, move_range)
# 生成随机的上下移动距离
move_y = random.randint(-10, 10)
# 移动鼠标
pyautogui.moveRel(move_x, move_y, duration=0.2)
time.sleep(0.2) # 停顿一段时间
# 回到原始位置
pyautogui.moveTo(xx, y, duration=0.2)
time.sleep(0.2) # 停顿一段时间
print("松开")
pyautogui.mouseUp() pyautogui.mouseUp()
@staticmethod @staticmethod
...@@ -144,18 +125,19 @@ class SlideUtils: ...@@ -144,18 +125,19 @@ class SlideUtils:
""" """
使用pyautogui实现滑块并自定义轨迹方程 使用pyautogui实现滑块并自定义轨迹方程
""" """
# print(f"睡眠2秒后点击移动")
# time.sleep(2)
xx = x + offset + offset_increase xx = x + offset + offset_increase
pyautogui.moveTo(x, y, duration=0.3) pyautogui.moveTo(x, y, duration=0.1)
pyautogui.mouseDown() pyautogui.mouseDown()
y += random.randint(9, 19) y += random.randint(9, 19)
pyautogui.moveTo(x + int(offset * random.randint(15, 23) / 20), y, duration=0.5) pyautogui.moveTo(x + int(offset * random.randint(15, 23) / 20), y, duration=0.28)
y += random.randint(-9, 0) y += random.randint(-9, 0)
pyautogui.moveTo(x + int(offset * random.randint(17, 21) / 20), y, duration=random.randint(20, 31) / 100) pyautogui.moveTo(x + int(offset * random.randint(17, 21) / 20), y, duration=random.randint(20, 31) / 100)
pyautogui.moveTo(xx + random.randint(-2, 2), y, duration=0.8) y += random.randint(0, 8)
duration=random.randint(50, 99) / 100 pyautogui.moveTo(xx, y, duration=1.5)
print(duration) # print("睡眠2秒后松开")
pyautogui.moveRel(0, random.randint(2, 20), duration=duration) # time.sleep(0.3)
print("松开")
pyautogui.mouseUp() pyautogui.mouseUp()
# print(f"睡眠2秒后点击 # print(f"睡眠2秒后点击
# time.sleep(2) # time.sleep(2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment