Posts filed under 'resources'

Day of Color

To run the code in Processing, you will need the MyGUI library.

In class code:
We seem to have found another bug, this one resolved by moving the colorMode() call to draw().

color frontColor, backColor;
int hueValue, compHueValue; 

void setup() {
  size(500, 500);
  //default:
  // colorMode(RGB, 256);
  // standard format for HSB (degrees):
  colorMode(HSB, 360);
  frameRate(15);

  hueValue = 0;
  compHueValue = hueValue + 180;
  smooth();
}

void draw() {
  colorMode(HSB, 360);
//  println (hueValue + "t" + compHueValue);
 frontColor = color(hueValue, 359, 359);
 backColor = color (compHueValue, 359, 359);
 background(backColor);

 fill(frontColor);
 noStroke();
 ellipse(width/2, height/2, 500, 500);

 hueValue+=1;
 if (hueValue == 360)
  hueValue = 0; 

 compHueValue = hueValue + 180;
 if (compHueValue >= 360)
   compHueValue -= 360;
}

bene posted on February 12th, 2008    Add comment

ToolBox v.1

class ToolBox contains an assortment of useful member variables and functions.

Contents
-vCenter [contains int value of the vertical center of the screen]
-hCenter [contains int value of the horizontal center of the screen]

  • color randomColor()
    returns a color object with random RBG values
  • color randomHueColor()
    returns a color object with a random hue value and full brightness and saturation
  • color randomSaturationColor(int HueVal)
    returns a color object with a hue of HueVal, random saturation value, and full brightness
  • color randomBrightnessColor(int HueVal)
    returns a color object with a hue of HueVal, full saturation, and a random brightness value

Usage
create an object of type ToolBox:

ToolBox tb = new ToolBox();

to use any of the fields or functions:

int verticalCenterOfScreen = tb.vCenter;
int randomHue = tb.randomInt();
fill(tb.randomSaturationColor(randomHue));

bene posted on March 14th, 2007    1 comment

Anatomy of a Class

New reference PDF is up, with a walkthrough of creating the class Blinker.

Download document and source code.

bene posted on March 8th, 2007    1 comment


Pages

Calendar

January 2009
M T W T F S S
« May    
 1234
567891011
12131415161718
19202122232425
262728293031  

Posts by Month

Posts by Category