/ Published in: ActionScript 3
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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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;
URL: http://www.boostworthy.com/blog/?p=200