Skip to content

Commit

Permalink
Merge pull request #40 from hyb1996/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
hyb1996 authored Aug 10, 2020
2 parents a98204f + fbdd044 commit ff8c0a1
Show file tree
Hide file tree
Showing 68 changed files with 8,180 additions and 2,963 deletions.
1 change: 1 addition & 0 deletions api/_404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 页面找不到了o(╥﹏╥)o
9 changes: 9 additions & 0 deletions api/_coverpage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
![logo](images/logo.png)

# Auto.js

> **不需要Root权限**的JavaScript自动化软件
[GitHub](https://github.com/hyb1996/Auto.js)
[软件下载](https://www.coolapk.com/apk/129872)
[阅读文档](#综述)
28 changes: 28 additions & 0 deletions api/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
* [首页](/)
* [Q&A](/qa)
* [如何阅读本文档 - Documentation](/documentation)
* [应用 - App](/app)
* [一般全局函数 - Globals](/globals)
* [控制台 - Console](/console)
* [基于坐标的操作 - CoordinatesBasedAutomation](/coordinatesBasedAutomation)
* [加解密与消息摘要 - Crypto](/crypto)
* [设备 - Device](/device)
* [对话框 - Dialogs](/dialogs)
* [脚本引擎 - Engines](/engines)
* [事件与监听 - Events](/events)
* [悬浮窗 - Floaty](/floaty)
* [文件系统 - Files](/files)
* [HTTP - Http](/http)
* [图片与颜色 - Images](/images)
* [画布 - Canvas](/canvas)
* [按键模拟 - Keys](/keys)
* [多媒体 - Media](/media)
* [模块 - Modules](/modules)
* [基于控件的操作 - WidgetsBaseAutomation](/widgetsBasedAutomation)
* [传感器 - Sensor](/sensors)
* [Shell - Shell](/shell)
* [本地储存 - Storages](/storages)
* [多线程 - Threads](/threads)
* [定时器 - Timers](/timers)
* [用户界面 - UI](/ui)
* [调用Java - Work with Java](https://developer.mozilla.org/zh-CN/docs/Mozilla/Projects/Rhino/Scripting_Java)
5 changes: 3 additions & 2 deletions api/_toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
* [Overview - 综述](overview.html)
* [Q&A - 常见问题](qa.html)
* [App - 应用](app.html)
* [Canvas - 画布](canvas.html)
* [Console - 控制台](console.html)
* [CoordinatesBasedAutomation - 基于坐标的操作](coordinates-based-automation.html)
* [CoordinatesBasedAutomation - 基于坐标的操作](coordinatesBasedAutomation.html)
* [Crypto - 加解密与消息摘要](crypto.html)
* [Device - 设备](device.html)
* [Dialogs - 对话框](dialogs.html)
Expand All @@ -24,13 +25,13 @@
* [Keys - 按键模拟](keys.html)
* [Media - 多媒体](media.html)
* [Modules - 模块](modules.html)
* [WidgetsBasedAutomation - 基于控件的操作](widgets-based-automation.html)
* [Sensors - 传感器](sensors.html)
* [Shell - Shell命令](shell.html)
* [Storages - 本地存储](storages.html)
* [Threads - 多线程](threads.html)
* [Timers - 定时器](timers.html)
* [UI - 用户界面](ui.html)
* [WidgetsBasedAutomation - 基于控件的操作](widgetsBasedAutomation.html)
* [Work with Java - 调用Java API](https://developer.mozilla.org/zh-CN/docs/Mozilla/Projects/Rhino/Scripting_Java)

<div class="line"></div>
Expand Down
7 changes: 4 additions & 3 deletions api/all.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@include overview
@include qa
@include app
@include canvas
@include console
@include coordinates-based-automation
@include coordinatesBasedAutomation
@include crypto
@include device
@include dialogs
Expand All @@ -16,10 +17,10 @@
@include keys
@include media
@include modules
@include widgets-based-automation
@include sensors
@include shell
@include storages
@include threads
@include timers
@include ui
@include ui
@include widgetsBasedAutomation
139 changes: 135 additions & 4 deletions api/canvas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

canvas提供了使用画布进行2D画图的支持,可用于简单的小游戏开发或者图片编辑。使用canvas可以轻松地在一张图片或一个界面上绘制各种线与图形。

canvas的坐标系为平面直角坐标系,以屏幕左上角为原点,屏幕上边为x轴正方向,屏幕左边为y轴正方向。例如分辨率为1920*1080的屏幕上,画一条从屏幕左上角到屏幕右下角的线段为:
canvas的坐标系为平面直角坐标系,以控件左上角为原点,控件上边沿为x轴正方向,控件左边沿为y轴正方向。例如分辨率为1920*1080的屏幕上,canvas控件覆盖全屏,画一条从屏幕左上角到屏幕右下角的线段为:

```
canvas.drawLine(0, 0, 1080, 1920, paint);
Expand Down Expand Up @@ -30,9 +30,140 @@ paint.setColor(colors.RED);
canvas.drawRect(0, 0, 100, 100, paint);
```

结合画笔canvas可以绘制基本图形、图片等。
结合画笔,canvas可以绘制基本图形、图片等。

## canvas.getWidth()
* 返回 {number}

返回画布当前图层的宽度。

## canvas.getHeight()
* 返回 {number}

返回画布当前图层的高度。

## canvas.drawRGB(r, int g, int b)
* `r` {number} 红色通道值
* `g` {number} 绿色通道值
* `b` {number} 蓝色通道值

将整个可绘制区域填充为r、g、b指定的颜色。相当于 `canvas.drawColor(colors.rgb(r, g, b))`

## canvas.drawARGB(a, r, g, b)
* `a` {number} 透明通道值
* `r` {number} 红色通道值
* `g` {number} 绿色通道值
* `b` {number} 蓝色通道值

将整个可绘制区域填充为a、r、g、b指定的颜色。相当于 `canvas.drawColor(colors.argb(a, r, g, b))`

## canvas.drawColor(color)
* `color` {number} 颜色值

将整个可绘制区域填充为color指定的颜色。

## canvas.drawColor(color, mode)
* `color` {number} 颜色值
* `mode` {PorterDuff.Mode} Porter-Duff操作

将整个可绘制区域填充为color指定的颜色。

## canvas.drawPaint(paint)
* `paint` {Paint} 画笔

将整个可绘制区域用paint指定的画笔填充。相当于绘制一个无限大的矩形,但是更快。
通过该方法可以绘制一个指定的着色器的图案。

## canvas.drawPoint(x, y, paint)
* `x` {number} x坐标
* `y` {number} y坐标
* `paint` {Paint} 画笔

在可绘制区域绘制由坐标(x, y)指定的点。
点的形状由画笔的线帽决定(参见paint.setStrokeCap(cap))。
点的大小由画笔的宽度决定(参见paint.setStrokeWidth(width))。
> 如果画笔宽度为0,则也会绘制1个像素至4个(若抗锯齿启用)。
相当于 `canvas.drawPoints([x, y], paint)`

## canvas.drawPoints(pts, paint)
* `pts` {Array<number>} 点坐标数组 [x0, y0, x1, y1, x2, y2, ...]
* `paint` {Paint} 画笔

在可绘制区域绘制由坐标数组指定的多个点。

## canvas.drawLine(startX, startY, stopX, stopY, paint)
* `startX` {number} 起点x坐标
* `startY` {number} 起点y坐标
* `endX` {number} 终点x坐标
* `endY` {number} 终点y坐标
* `paint` {Paint} 画笔

在可绘制区域绘制由起点坐标(startX, startY)和终点坐标(endX, endY)指定的线。
绘制时会忽略画笔的样式(Style)。也就是说,即使样式设为“仅填充(FILL)”也会绘制。
退化为点的线(长度为0)不会被绘制。

## canvas.drawRect(r, paint)
* `r` {Rect} 矩形边界
* `paint` {Paint} 画笔

在可绘制区域绘制由矩形边界r指定的矩形。
绘制时画笔的样式(Style)决定了是否绘制矩形界线和填充矩形。

## canvas.drawRect(left, top, right, bottom, android.graphics.Paint paint)
* `left` {number} 矩形左边界x坐标
* `top` {number} 矩形上边界y坐标
* `right` {number} 矩形右边界x坐标
* `bottom` {number} 矩形下边界y坐标
* `paint` {Paint} 画笔

在可绘制区域绘制由矩形边界(left, top, right, bottom)指定的矩形。
绘制时画笔的样式(Style)决定了是否绘制矩形界线和填充矩形。

## canvas.drawOval(android.graphics.RectF oval, android.graphics.Paint paint)
## canvas.drawOval(float left, float top, float right, float bottom, android.graphics.Paint paint)
## canvas.drawCircle(float cx, float cy, float radius, android.graphics.Paint paint)
## canvas.drawArc(android.graphics.RectF oval, float startAngle, float sweepAngle, boolean useCenter, android.graphics.Paint paint)
## canvas.drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, android.graphics.Paint paint)
## canvas.drawRoundRect(android.graphics.RectF rect, float rx, float ry, android.graphics.Paint paint)
## canvas.drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, android.graphics.Paint paint)
## canvas.drawPath(android.graphics.Path path, android.graphics.Paint paint)
## canvas.drawBitmap(android.graphics.Bitmap bitmap, float left, float top, android.graphics.Paint paint)
## canvas.drawText(java.lang.String text, float x, float y, android.graphics.Paint paint)
## canvas.drawTextOnPath(java.lang.String text, android.graphics.Path path, float hOffset, float vOffset, android.graphics.Paint paint)

## canvas.translate(dx, dy)
* `dx` {number} 向x轴正方向平移的距离,负数表示反方向平移
* `dy` {number} 向y轴正方向平移的距离,负数表示反方向平移

平移指定距离。

## canvas.scale(sx, sy)
* `sx` {number} 向x轴正方向平移的距离,负数表示反方向平移
* `sy` {number} 向y轴正方向平移的距离,负数表示反方向平移

以原点为中心,将坐标系平移缩放指定倍数。

## canvas.scale(float sx, float sy, float px, float py)
## canvas.rotate(float degrees)
## canvas.rotate(float degrees, float px, float py)
## canvas.skew(float sx, float sy)

# 画笔

# 变换矩阵

# 路径

# Porter-Duff操作

# 着色器

# 遮罩过滤器

# 颜色过滤器

# 路径特效

# 区域

## canvas.draw

File renamed without changes.
Binary file added api/images/ex-gravity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex-layout-gravity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex-marginLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex-padding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex-properties.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex-w.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex1-horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex1-margin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/ex2-margin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added api/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions api/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Auto.js</title>
<base href="./">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link href="static/vue.css" rel="stylesheet">
<!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> -->
</head>

<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Auto.js Pro文档',
repo: 'hyb1996/AutoJs-Docs',
notFoundPage: true,
loadSidebar: true,
subMaxLevel: 2,
coverpage: true,
homepage: 'overview.md',
maxAge: 0
}
if (localhost.host != null && location.host.indexOf('localhost') < 0) {
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
}
</script>
<script src="static/docsify.min.js"></script>
<script src="static/search.min.js"></script>
<!-- <script src="//unpkg.com/docsify/lib/docsify.js"></script> -->
<!-- <script src="//unpkg.com/docsify"></script> -->
<!-- <script src="//unpkg.com/docsify/lib/plugins/search.js"></script> -->
</body>

</html>
4 changes: 3 additions & 1 deletion api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Auto.js使用[JavaScript](https://developer.mozilla.org/zh-CN/docs/Web/JavaScrip
* 因为Auto.js是基于JavaScript的,学习Auto.js的API之前建议先学习JavaScript的基本语法和内置对象,可以使用教程前面的两个JavaScript教程链接来学习。
* 如果您想要使用TypeScript来开发,目前已经有开发者公布了一个可以把使用TypeScript进行Auto.js开发的工具,参见[Auto.js DevTools](https://github.com/pboymt/autojs-dev)
* 如果想要在电脑而不是手机上开发Auto.js,可以使用VS Code以及相应的Auto.js插件使得在电脑上编辑的脚本能推送到手机运行,参见[Auto.js-VSCode-Extension](https://github.com/hyb1996/Auto.js-VSCode-Extension),Auto.js Pro用户则需要使用[Auto.js-Pro-Ext](https://marketplace.visualstudio.com/items?itemName=hyb1996.auto-js-pro-ext)
* 支持Node.js已在计划中,预计2020年底在Auto.js Pro中支持

本文档的章节大致上是以模块来分的,总体上可以分成"自动操作"类模块(控件操作、触摸模拟、按键模拟等)和其他类模块(设备、应用、界面等)。

Expand All @@ -25,4 +26,5 @@ Auto.js使用[JavaScript](https://developer.mozilla.org/zh-CN/docs/Web/JavaScrip
* threads: 多线程支持。
* ui: UI界面。用于显示自定义的UI界面,和用户交互。

除此之外,Auto.js内置了对[Promise](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)
除此之外,Auto.js内置了对[Promise](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise)

1 change: 1 addition & 0 deletions api/static/docsify.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions api/static/search.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ff8c0a1

Please sign in to comment.