0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-04-30

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

hue()

説明文

指定した色から色相値を取得します。

色相はHSBとHSLの両方に存在します。この関数はHSBカラーを指定した場合にHSBの色相値を返しますが、それ以外の場合はデフォルトでHSLの色相値を返します。 (返す色相値は最大色相設定により異なります)

構文

hue(color)

パラメタ

  • color
    p5.Color | Number[ ] | String:p5.Colorオブジェクト、カラーコンポーネント、CSSカラー

戻り値

Number:色相値

function draw() {
  colorMode(HSB, 255); // カラーモードをHSBに設定
  let c = color(180, 126, 255);
  fill(c);
  rect(15, 20, 35, 60);
  value = hue(c); // 色相値180を取得する
  fill(value);
  rect(50, 20, 35, 60);
}

実行結果

hue.JPG

著作権

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