LoginSignup
0
0

More than 3 years have passed since last update.

P5.js 日本語リファレンス(cylinder)

Last updated at Posted at 2020-05-08

このページでは「P5.js 日本語リファレンス」 の cylinder関数を説明します。

cylinder()

説明文

与えられた半径と高さで円柱を描画する。

detailX と detailY は, 円柱のx方向とy方向の分割数を指定します。分割数を増やすと円柱がより滑らかに見えます。 detailX の推奨最大値は24です。24より大きい値を使用すると警告が発生したり、ブラウザーの速度が低下したりする場合があります。

構文

cylinder([radius], [height], [detailX], [detailY], [bottomCap], [topCap])

パラメタ

  • radius
    Number:円柱の半径(オプション、デフォルト値は50)

  • height
    Number:円柱の高さ(オプション、デフォルト値は半径)

  • detailX
    Number:X方向の分割数(オプション、デフォルト値は24)

  • detailY
    Number:Y方向の分割数(オプション、デフォルト値は1)

  • bottomCap
    Boolean:円柱の底を描くかどうか(オプション、デフォルトは true)

  • topCap
    Boolean:円柱の上部を描画するかどうか(オプション、デフォルトは true)

例1

function setup(){
  createCanvas(100, 100, WEBGL);
}

function draw(){
  background(205, 105, 94);
  rotateX(frameCount * 0.01);
  rotateZ(frameCount * 0.01);
  // 円柱を描画(半径20、高さ50、x方向分割数6、y方向分割数3、円柱の上部を描画しない)
  cylinder(20, 50, 6, 3, true, false);
}

実行結果

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0