How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Table of Contents

Problem Statement

Display a series of vertical color bars across the width of the display. The color bars should either use:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Source code in the processing programming language

fullScreen();
noStroke();
color[] cs = {
  color(0),         // black
  color(255,0,0),   // red
  color(0,255,0),   // green
  color(255,0,255), // magenta
  color(0,255,255), // cyan
  color(255,255,0), // yellow
  color(255)        // white
};
for(int i=0; i<7; i++) {
  fill(cs[i]);
  rect(i*width/8,0,width/8,height);
}

  

You may also check:How to resolve the algorithm Euler's constant 0.5772... step by step in the Processing programming language
You may also check:How to resolve the algorithm Call an object method step by step in the Processing programming language
You may also check:How to resolve the algorithm Draw a pixel step by step in the Processing programming language
You may also check:How to resolve the algorithm Musical scale step by step in the Processing programming language
You may also check:How to resolve the algorithm Pentagram step by step in the Processing programming language