cone

def setup
  createCanvas(100, 100, WEBGL)
end

def draw
  background(200)
  rotateX(frameCount * 0.02)
  rotateZ(frameCount * 0.02)
  cone(40, 70)
end
def setup
  createCanvas(100, 100, WEBGL)
  @detailX = createSlider(3, 16, 3)
  @detailX.position(10, height + 5)
  @detailX.style('width', '80px')
end

def draw
  background(205, 102, 94)
  rotateY(millis / 1000)
  cone(30, 65, @detailX.value, 16)
end
def setup
  createCanvas(100, 100, WEBGL)
  @detailY = createSlider(3, 16, 3)
  @detailY.position(10, height + 5)
  @detailY.style('width', '80px')
end

def draw
  background(205, 102, 94)
  rotateY(millis / 1000)
  cone(30, 65, 16, @detailY.value)
end

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

[p5.js] cone

概要

円錐を描画します。

書式

cone([radius] [, height] [, detailX] [, detailY] [, cap])

引数

引数名内容備考オプションデフォルト値
radius円錐の底面の半径50
height円錐の高さradiusの値
detailXx方向の細分割数24
detailYy方向の細分割数1
cap底面を描画するかどうかtrue
false
true

戻値

なし

備考

関連