def setup
colorMode(RGB)
stroke(255)
background(51)
from = color(218, 165, 32)
to = color(72, 61, 139)
colorMode(RGB) # Try changing to HSB.
interA = lerpColor(from, to, 0.33)
interB = lerpColor(from, to, 0.66)
fill(from)
rect(10, 20, 20, 60)
fill(interA)
rect(30, 20, 20, 60)
fill(interB)
rect(50, 20, 20, 60)
fill(to)
rect(70, 20, 20, 60)
end
2つの色の中間にある色を生成します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| c1 | 色1 | p5.Colorオブジェクト | ||
| c2 | 色2 | p5.Colorオブジェクト | ||
| amt | 中間度 | 0~1 |
p5.Colorオブジェクト
・引数 amdの値が小さいほど「色1」に近い色、引数 amdの値が大きいほど「色2」に近い色になります。