mouseWheel

概要

※p5.jsでは引数として eventオブジェクトを受け取りますが、
 rbCanvas/pでは event.deltaの値を受け取ります。

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

[p5.js] mouseWheel

サンプル

def setup
  @pos = 25
end

def draw
  background(237, 34, 93)
  fill(0)
  rect(25, @pos, 50, 50)
end

def mouseWheel(delta)
  # move the square according to the vertical scroll amount
  @pos += (delta / delta.abs) * 10
  # uncomment to block page scrolling
  return false
end

構文

戻値