createCapture

def setup
  createCanvas(100, 100)
  @capture = createCapture(VIDEO)
  @capture.hide
end

def draw
  image(@capture, 0, 0, width, width * @capture.height / @capture.width)
  filter(INVERT)
end
def setup
  createCanvas(100, 100)
  @capture = createCapture(VIDEO)
  @capture.hide
end

def draw
  if @capture.loadedmetadata
    c = @capture.get(0, 0, 100, 100)
    image(c, 0, 0)
  end
end

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

[p5.js] createCapture

概要

ビデオキャプチャを生成します。

書式

createCapture(type)

引数

引数名内容備考オプションデフォルト値
typeキャプチャタイプVIDEO : ビデオ
AUDIO : オーディオ

戻値

p5.Elementオブジェクト
(<video></video>タグの HTMLエレメント)

備考

・セキュリティに関する詳細については、下記の URLを参照してください。
  MediaDevices.getUserMedia()

関連