Use "{" processing to write the code

Source code
 
// Load the colour wheel
 
final int centre_x = 399;
final int centre_y = 399;
final int radius_l = 750;
final int radius_s = 200;
final int max_radius = 360;
final int max_ls = 100;
final int radius_p = 160;
void setup()
{
  size(800, 800);  //set the size
  background( 255 );
   
  stroke( 0 );
  strokeWeight(2);
   
  noFill();
  //ellipse( centre_x, centre_y, radius_l, radius_l );
  //ellipse( centre_x, centre_y, radius_s - 6  , radius_s - 6 );
   
  noStroke();
  colorMode( HSB, max_radius, max_ls, max_ls );
   
  for( float h = 0; h < max_radius; h += 0.125 )  {
    for( float s = 50; s < max_ls; s += 0.25 )  {
      int pt_x;
      int pt_y;
      float pt_rad = (radius_l - radius_s) / 2;
      pt_rad = pt_rad / (max_ls - 50) * (s - 50) + radius_s / 2;
      // this is the scale of the radius
      pt_x = round(sin( radians(h + 90) ) * pt_rad) + centre_x;
      pt_y = round(cos( radians(h + 90) ) * pt_rad) + centre_y;
       
      stroke( h , s, max_ls / 2 + s / 2 );
      point( pt_x, pt_y );
    }
  }
}
void draw()
{
  noStroke();
  colorMode( HSB, 360, 100, 100 );
  int pt_x = mouseX - centre_x;
  int pt_y = mouseY - centre_y;
   
  //Get radius
  float pt_rad = sqrt( sq( pt_x ) + sq( pt_y ) ) - radius_s / 2;
  float pt_rad_l = (radius_l - radius_s) / 2;
  pt_rad = pt_rad / pt_rad_l * max_ls;
  float pt_hue = atan( 1.0 * pt_x / pt_y );
  pt_hue = degrees( pt_hue );
  if( pt_y < 0 )  {
    pt_hue += 180; 
  }
  pt_hue -= 90;
  if( pt_hue < 0 )  {
    pt_hue += 360;
  }
   
  if( pt_rad >=0 && pt_rad <= 100 )  {
    fill( pt_hue, pt_rad / 2 + 50, max_ls / 2 + pt_rad / 2  );
  }
  else  {
    fill(0, 0, 0);
  }
  ellipse(centre_x, centre_y, radius_p, radius_p );
}

1 Comment