GSDP:GAM100/CProcessing/PColorHSV
From Inside
< GSDP:GAM100 | CProcessing
Revision as of 11:05, 20 October 2019 by >Zachary.logsdon
PColor
Description
PColorHSV stores a color in Hue, Saturation, Value, and Alpha form. Note, you must use hsv2rgb() to use a PColorHSV in any function that takes a PColor.
Example
void init()
{
size(400, 400);
rectMode(CORNER);
}
void update()
{
background(color(0, 0, 0, 255));
PColorHSV hsv = colorHSV((frameCount * 3) % 360, 100, 50, 255);
fill(hsv2rgb(hsv));
rectRounded(10, 10, 380, 190, 20);
PColor rgb = color((int)((sinf(frameCount * 0.05f) + 1.0f) * 128.0f) % 256,
(int)((sinf(frameCount * 0.05f + 2.0f * PI / 3.0f) + 1.0f) * 128.0f) % 256,
(int)((sinf(frameCount * 0.05f + 4.0f * PI / 3.0f) + 1.0f) * 128.0f) % 256, 255);
fill(hsv2rgb(rgb2hsv(rgb)));
rectRounded(10, 210, 380, 190, 20);
}