有没有办法使用 jQuery 使鼠标光标以圆形形式重复移动?
将用于测试Parallax.js GPU/CPU 上的负载。
最佳答案
无法使用 Javascript 控制用户鼠标。其背后的目的是防止点击劫持和光标劫持。考虑以下场景:
1) User clicks a link.
2) Javascript forces the mouse to move to another link prior to click.
3) User ends up clicking a link with lots of NSFW stuff and gets fired.
另外,从 Cookieclicker 的 Angular 考虑另一种情况:
<小时/>1) User injects a cursor automation script into console.
2) User proceeds to play the game without making a single click themselves.
光标控制的替代方法
但是,您可以查找可以模拟事件的框架的 Javascript 页面自动化测试,而不是移动鼠标光标的方法;包括光标移动。 <强> This 将是可以为您控制鼠标的第三方应用程序。您还可以使用 jQuery trigger用于当 origin-x 或 y
更改时触发的自定义事件。
Parallax Engine that reacts to the orientation of a smart device. Where no gyroscope or motion detection hardware is available, the position of the cursor is used instead.
我们从它的文档中看到 Parallax 是一个对光标事件使用react的库。此外,从我看来,光标位置似乎被转换为origin-x和origin-y输入;两个值的默认值为 0.5(视口(viewport)的中心),x
- 0 为左,1 为右,y
- 0 为顶部,1 为底部。与其为光标创建自动化,不如自动化这些值来模拟某些运动所需的输入。
关于javascript - 用 jQuery 模拟鼠标的圆形移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27068839/