texture

概要

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

[p5.js] texture

サンプル

def setup
  createCanvas(100, 100, WEBGL)
  @img = loadImage("panda.png")
end

def draw
  background(0)
  rotateZ(frameCount * 0.02)
  rotateX(frameCount * 0.02)
  rotateY(frameCount * 0.02)
  # pass image as texture
  texture(@img)
  box(width / 2)
end
def setup
  createCanvas(100, 100, WEBGL)
  @pg = createGraphics(200, 200)
  @pg.textSize(75)
end

def draw
  background(0)
  @pg.background(255)
  @pg.text('hello!', 0, 100)
  # pass image as texture
  texture(@pg)
  rotateX(0.5)
  noStroke
  plane(50)
end

構文

戻値