Skip to main content

Move finger on screen (:move)

Declaration

te = te:move(x, y)

Parameters

  • x, y
    Integer. Target coordinates in the current rotation coordinate system.

Returns

  • te
    Touch event object itself. You can get a touch event object via touch.on.

Notes

  • Simulate moving the finger from current position to another position.
  • This method may yield; before it returns, other threads may get a chance to run.
  • You can also call it in the following forms (finger ID must be 1 ~ 29):
touch.move(finger_id, x, y)
touch.move(finger_id, x, y, pressure)

The above calls differ from the :move method in that they move immediately to the target without step configuration.

Example

-- Touch at 100,100 then slide to 200,200 and lift
touch.on(100, 100):move(200, 200):off()

-- Another usage
touch.on(1, 100, 100) -- finger #1 touches at 100,100
for i=1, 100 do -- move finger #1 step by step to 100,200
touch.move(1, 100, 100 + i)
end
touch.off(1) -- lift finger #1