def setup
createCanvas(100, 100, WEBGL)
end
def draw
background(205, 105, 94)
rotateZ(frameCount * 0.02)
rotateX(frameCount * 0.02)
cylinder(20, 50)
end
def setup
createCanvas(100, 100, WEBGL)
@detailX = createSlider(3, 24, 3)
@detailX.position(10, height + 5)
@detailX.style('width', '80px')
end
def draw
background(205, 105, 94)
rotateY(millis / 1000)
cylinder(20, 75, @detailX.value, 1)
end
def setup
createCanvas(100, 100, WEBGL)
@detailY = createSlider(1, 16, 1)
@detailY.position(10, height + 5)
@detailY.style('width', '80px')
end
def draw
background(205, 105, 94)
rotateY(millis / 1000)
cylinder(20, 75, 16, @detailY.value)
end
円柱を描画します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| radius | 円柱の底面の半径 | ○ | 50 | |
| height | 円柱の高さ | ○ | radiusの値 | |
| detailX | x方向の細分割数 | ○ | 24 | |
| detailY | y方向の細分割数 | ○ | 1 | |
| bottomCap | 底面を描画するかどうか | true false | ○ | true |
| topCap | 上面を描画するかどうか | true false | ○ | true |
なし