createImg

def setup
  background(220)
  img = createImg('https://p5js.org/assets/img/asterisk-01.png', 'logo')
  img.position(0, 0)
  img.size(width, height)
end

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

[p5.js] createImg

概要

DOMのイメージ要素を生成します。

書式

createImg(src, alt [, crossOrigin])

引数

引数名内容備考オプションデフォルト値
srcデータソースまたは
イメージ画像の URL
alt代替テキスト
crossOriginイメージ要素の crossoriginプロパティ
'anonymous'
'use-credentials'
''(空文字)

戻値

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

備考

関連