Skip to content

Commit

Permalink
Create 圆形渐开线.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chudongjingling authored May 22, 2020
1 parent d8fa9e0 commit 847b74b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 渐开线/圆形渐开线.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
init(1)
mSleep(1000)

local x0 = 1010 --起始坐标x
local y0 = 698 --起始坐标y
local rr = 20 --设置递增半径
local l = 10 --设置点间距
local p = 0 --初始化角度
local r = 30 --设置首圈半径
local rn = 10 --设置圈数
touchDown(x0, y0)
mSleep(100)
for var = 1,rn do
while p < math.pi * 2 do
x = x0 + r * math.cos(p)
y = y0 - r * math.sin(p)
touchMove(x, y)
mSleep(10)
p = p + l/r
end
p = 0
r = r + rr
end
touchUp(x0, y0)

0 comments on commit 847b74b

Please sign in to comment.