stroke

def setup
  # Grayscale integer value
  background(220)
  strokeWeight(4)
  stroke(51)
  rect(20, 20, 60, 60)
end
def setup
  # R, G & B integer values
  background(220)
  stroke(255, 204, 0)
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # H, S & B integer values
  background(220)
  colorMode(HSB)
  strokeWeight(4)
  stroke(255, 204, 100)
  rect(20, 20, 60, 60)
end
def setup
  # Named SVG/CSS color string
  background(220)
  stroke('red')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # three-digit hexadecimal RGB notation
  background(220)
  stroke('#fae')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # six-digit hexadecimal RGB notation
  background(220)
  stroke('#222222')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # integer RGB notation
  background(220)
  stroke('rgb(0, 255, 0)')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # integer RGBA notation
  background(220)
  stroke('rgba(0, 255, 0, 0.25)')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # percentage RGB notation
  background(220)
  stroke('rgb(100%, 0%, 10%)')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # percentage RGBA notation
  background(220)
  stroke('rgba(100%, 0%, 100%, 0.5)')
  strokeWeight(4)
  rect(20, 20, 60, 60)
end
def setup
  # p5 Color object
  background(220)
  stroke(color(0, 0, 255))
  strokeWeight(4)
  rect(20, 20, 60, 60)
end

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

[p5.js] stroke

概要

図形や文字の境界線の色を設定します。

書式

stroke(gray [, a])
stroke(v1, v2, v3 [, a])
stroke(values)
stroke(colorstring)
stroke(color)

引数

引数名内容備考オプションデフォルト値
grayグレースケール0~255
v1赤 または 色相0~255
colorModeの設定に依存
v2緑 または 彩度0~255
colorModeの設定に依存
v3青 または 輝度(明度)0~255
colorModeの設定に依存
values配列[v1, v2, v3, 透明度]
colorModeの設定に依存
colorstring色文字列
colorp5.Colorオブジェクト
a透明度0~255
(0 : 完全な透明)
colorModeの設定に依存
RGBモード : 255
HSLモード/HSBモード : 1

戻値

なし

備考

関連

colorMode
色(カラー)