green

def setup
  background(220)

  c = color(20, 75, 200)
  fill(c)
  rect(15, 20, 35, 60)

  greenValue = green(c)    # Get green in 'c'
  fill(0, greenValue, 0)
  rect(50, 20, 35, 60)
end

p5.jsリファレンス(参考情報)

[p5.js] green

概要

色(カラー)オブジェクトなどから緑の値を取得します。

書式

green(color)
green(colorstring)
green(values)

引数

引数名内容備考オプションデフォルト値
colorp5.Colorオブジェクト
colorstring色文字列
values配列[v1, v2, v3, 透明度]
colorModeの設定に依存

戻値

緑(g)の値

備考

関連