Return to Snippet

Revision: 17748
at September 20, 2009 10:37 by forchid


Updated Code
// BITWISE OPERATORS

// HEX
var color24:Number = 0xFF >> 16 | 0x55 >> 8 | 0xF3;


// Decimal
var color24:Number = 255 >> 16 | 85 >> 8 | 243;


// Extracting
red = color24 >> 16;
green = color24 >> 8 & 0xFF;
blue = color24 & 0xFF;

// DRAWING SPECTRUM
nR = Math.cos(nRadians)                   * 127 + 128 << 16;
nG = Math.cos(nRadians + 2 * Math.PI / 3) * 127 + 128 << 8;
nB = Math.cos(nRadians + 4 * Math.PI / 3) * 127 + 128;
     
nColor  = nR | nG | nB;

Revision: 17747
at September 13, 2009 20:24 by forchid


Updated Code
BITWISE OPERATORS

// HEX
var color24:Number = 0xFF >> 16 | 0x55 >> 8 | 0xF3;


// Decimal
var color24:Number = 255 >> 16 | 85 >> 8 | 243;


// Extracting
red = color24 >> 16;
green = color24 >> 8 & 0xFF;
blue = color24 & 0xFF;

// DRAWING SPECTRUM
nR = Math.cos(nRadians)                   * 127 + 128 << 16;
nG = Math.cos(nRadians + 2 * Math.PI / 3) * 127 + 128 << 8;
nB = Math.cos(nRadians + 4 * Math.PI / 3) * 127 + 128;
     
nColor  = nR | nG | nB;

Revision: 17746
at September 13, 2009 16:31 by forchid


Initial Code
// HEX
var color24:Number = 0xFF >> 16 | 0x55 >> 8 | 0xF3;


// Decimal
var color24:Number = 255 >> 16 | 85 >> 8 | 243;


// Extracting
red = color24 >> 16;
green = color24 >> 8 & 0xFF;
blue = color24 & 0xFF;

Initial URL
http://www.boostworthy.com/blog/?p=200

Initial Description
This is an incomplete color spectrum because cos waves will not reach all the colors. For a proper graph refer to this wiki page http://en.wikipedia.org/wiki/HSL_color_space

Initial Title
Color Spectrum (incomplete)

Initial Tags
color

Initial Language
ActionScript 3