EasyClick 免Root 仿真滑动函数封装实例

B站视频地址: https://www.bilibili.com/video/BV1W54y1Q7JG/

网站地址 : http://ieasyclick.com

技术交流QQ群 2557945562

新一代简单易学,开箱即用,可编程式自动化测试软件 免ROOT不限手机环境,

支持Android 5.0到10,全节点分析不限分辨率,OpenCV图色识别 JS编程简单易学,

IDEA智能开发工具支持,实时投屏预览运行 支持OpenApi,

不限调用者环境,跨语言调用。

以下代码是仿真滑动代码:

var result = startEnv();
logd('启动服务:'+result);

function bezier_curves(cp, t) {
    var cx,bx,ax,cy,by,ay,tSquared,tCubed,result
    cx = 3.0 * (cp[1].x - cp[0].x);
    bx = 3.0 * (cp[2].x - cp[1].x) - cx;
    ax = cp[3].x - cp[0].x - cx - bx;
    cy = 3.0 * (cp[1].y - cp[0].y);
    by = 3.0 * (cp[2].y - cp[1].y) - cy;
    ay = cp[3].y - cp[0].y - cy - by;

    tSquared = t * t;
    tCubed = tSquared * t;
    result = {
        "x": 0,
        "y": 0
    }
    result.x = (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x;
    result.y = (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y;
    return result;
}

//仿真随机带曲线滑动
//qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,times,timess =随机时间(times,timess)
function rnd_Swipe(qx, qy, zx, zy,time, times,timess) {
    var time1,xxy,point,dx0,dx1,dx2,dx3,xxyy
     time1=random(times,timess)

     xxy = [];
     point = [];
     dx0 = {
        "x": qx,
        "y": qy
    }

     dx1 = {
        "x": random(qx - 100, qx + 100),
        "y": random(qy , qy + 50)
    }
     dx2 = {
        "x": random(zx - 100, zx + 100),
        "y": random(zy , zy + 50),
    }
     dx3 = {
        "x": zx,
        "y": zy
    }
    for (var i = 0; i < 4; i++) {

        eval("point.push(dx" + i + ")");

    }

    for (let i = 0; i < 1; i += 0.08) {
        xxyy = [parseInt(bezier_curves(point, i).x), parseInt(bezier_curves(point, i).y)]
        xxy.push(xxyy);

    }
    
    gesture(xxy,time, time1);
}

function gesture(swipeList,time,time1) {
    var touch1 ,touch2,x,i
    touch1 = [{"action": 0, "x": swipeList[0][0], "y": swipeList[0][1], "pointer": 1, "delay": time}]

    for (i in swipeList){
        ++i;
        if (i===swipeList.length-2) {break;}

        touch1.push({"action": 1, "x": swipeList[i][0], "y": swipeList[i][1], "pointer": 1, "delay": time});

    }
    touch1.push({"action": 2, "x": swipeList[swipeList.length-1][0], "y": swipeList[swipeList.length-1][1], "pointer": 1, "delay": time})

    x = multiTouch(touch1, null, null, time1);
    logd('仿真滑动:'+x);
}

//qx, qy, zx, zy, time 代表起点x,起点y,终点x,终点y,times,timess =随机时间(times,timess)
rnd_Swipe(600,1800,300,400,30,100,500)

教程和示例代码:
EasyClick 播放Mp3 代码
EasyClick 免Root 快捷点击函数封装实例​​​​​​​

仿真滑动函数实例

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值