LoginSignup
0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-08-01

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

point()

説明文

点を描画します。最初のパラメータはポイントの水平方向の値、2番目のパラメータはポイントの垂直方向の値です。ポイントの色は stroke() で変更されます。ポイントのサイズは strokeWeight() で変更されます。

構文

point(x, y, [z])

point(coordinate_vector)

パラメタ

  • x
    Number:X座標

  • y
    Number:Y座標

  • z
    Number:z座標(WebGLモードの場合)(オプション)

  • coordinate_vector
    p5.Vector:座標ベクトル

例1

function setup() {
  createCanvas(400, 400);

  //ポイントのサイズを10ピクセルにします
  strokeWeight(10);

  //色を紫色にします
  stroke('purple');

  point(30, 20);
  point(85, 20);
  point(85, 75);
  point(30, 75);

  //色を青色にします
  stroke('blue');

  // 座標ベクトルを設定して点を描画
  let a = createVector(10, 10);
  point(a);

  //色を赤色にします
  stroke('red');

  // 座標ベクトルで点の位置を指定
  point(createVector(20, 20));

}

実行結果

著作権

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) に従います。
P5.js 日本語リファレンス

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