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

2023-07-07 14:28:53 浏览数 (1)

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

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

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

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

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

111

代码语言:javascript复制
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 人点赞