pmouseX

# Move the mouse across the canvas to leave a trail
def setup
  # slow down the frameRate to make it more visible
  frameRate(10)
end

def draw
  background(244, 248, 252)
  line(mouseX, mouseY, pmouseX, pmouseY)
end

p5.jsリファレンス(参考情報)

[p5.js] pmouseX

概要

マウスポインタの1フレーム前の x座標の値が格納されているシステム変数です。

書式

pmouseX

備考

関連