0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-05-08

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

cone()

説明文

指定した半径と高さで円錐を描画する。

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

構文

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

パラメタ

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

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

  • detailX
    Integer:円周方向の分割数。分割数が多いほど滑らかな三角錐になります(オプション、デフォルト値は24)

  • detailY
    Integer:高さ方向の分割数。分割数が多いほど滑らかな三角錐になります(オプション、デフォルト値は1)

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

例1

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

function draw(){
  background(200);
  fill(205, 102, 94);
  rotateX(frameCount * 0.01);
  rotateZ(frameCount * 0.01);
  // 三角錐を描画(半径40、高さ90、円周方向分割数10、高さ方向分割数3、底面描画しない)
  cone(40, 90, 10, 3, 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