GSDP:GAM100/CProcessing/hsv2rgb()

From Inside
< GSDP:GAM100‎ | CProcessing
Revision as of 11:06, 20 October 2019 by >Zachary.logsdon (New page: {{GSDP:GAM100API.css}} =hsv2rgb()= ==Description== Converts a HSV PColorHSV to an RGB PColor. ===Parameters=== hsv...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

hsv2rgb()

Description

Converts a HSV PColorHSV to an RGB PColor.

Parameters

hsv2rgb(PColorHSV hsv)

  • hsv - (PColorHSV) The HSV value to convert to RGB.

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);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>