Creating rainbow using Processing programming language

Hello friends, meanwhile I was recalling back the days when I was learning processing language and suddenly thought of practicing a small experiment on it.  It was raining at my place and hence I thought of making an animated rainbow using processing programming language.

This is not-so-great program or project what so ever, but was fun doing it.

Animated Rainbow using Processing Language

Anybody interested may find the source code for the same below.

//processing program for creating an animated rainbow
//programmed by : Amit Biswal
//URL: http://amitbiswal.blogspot.com
int sunCenterX=650,sunCenterY=50;
int i=0,j=0;
void setup()
void draw()
  if(i<500 && j<500)

void sun()
  fill(255); //white

  fill(252,101,31); //orange
void rainbow(int centerX,int centerY)
  fill(255); //white

  fill(255,0,0); //red

  fill(257,127,0); //orange

  fill(255,255,0); //yellow

  fill(0,255,0); //green

  fill(0,0,255); //blue

  fill(75,0,130); //indigo

  fill(148,0,211); //violet
  fill(255); //white


The program is simple and self-explanatory. You can comment your queries below. If you can work over this and make some nice advanced version of this project then do share the code/link of your project. Thanks for reading.

Content is copyrighted © www.123mylist.com