1 / 10

Introduction to Color and Transparency in Programming

This guide explores the foundational concepts of color and transparency in programming using RGB values. It explains how to define colors through functions such as `background()`, `fill()`, and `stroke()`, emphasizing the range of values from 0 to 255 that create various shades. The use of `alpha` for opacity is also covered, providing examples to demonstrate both opaque and transparent effects. By grasping these concepts, programmers can enhance their visual outputs effectively. Note that this guide does not address the HSB color mode.

axelle
Télécharger la présentation

Introduction to Color and Transparency in Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Color by Numbers Pages 85-89 (Skipped Curves 79-84)

  2. Syntax Introduced • color • color() • colorMode()

  3. Red, Green, Blue • RGB is a common way to specify color • Minimum value of number is 0 • Maximum value of number is 255 • Resulting in 256 different shades for each color • 0 is black, 255 is the specific color…

  4. Functions that take color as parameters background(r,g,b); fill (r,g,b); fill(r,g,b,alpha) stroke(r,g,b); stroke(r,g,b, alpha) alpha is for opaque/transparency 0 – entirely transparent 255 – entirely opaque

  5. Example1 (size 100X100) background(129,130,87); noStroke(); fill(174,221,60); rect(17,17,66,66);

  6. Example2 background(129,130,87); noFill(); strokeWeight(4); Stroke(174,221,60); rect(19,19,62,62);

  7. Example 3: transparency background(116,193,206); noStroke(); fill(129,130,87,102); // more transparent rect(20,20,30,60); fill(129,130,87,204); // less transparent rect(50,20,30,60);

  8. Example 4 background(0); noStroke(); fill(242,204,47,160); // yellow ellipse(47,36,64,64); fill(174,221,60,160); // green ellipse(90,47,64,64); fill(116,193,206,160); // blue ellipse(57,79,64,64);

  9. color object color(gray); color(gray,alpha); color ruby= color(211,24,24,160); color pink = color(237,159,176); background(pink); noStroke(); fill(ruby); rect(35,0,20,200);

  10. Summary • We studied the usage of color and transparency • We will not cover other color mode HSB (Hue, Saturation, Brightness)

More Related