ColorCircle (2)
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pwwf
*/
////////////////////////////////////////////////////////////////////////////////
// ColorCircle (2)
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Shape;
import frocessing.color.ColorHSV;
[SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]
public class Main extends Sprite {
private var bitmapData:BitmapData;
private var color:ColorHSV;
private static var radian:Number = Math.PI/180;
public function Main() {
//Wonderfl.capture_delay(1);
init();
}
private function init():void {
graphics.beginFill(0x000000);
graphics.drawRect(0, 0, 465, 465);
graphics.endFill();
//
color = new ColorHSV();
bitmapData = new BitmapData(400, 400, false, 0xFF000000);
var bitmap:Bitmap = new Bitmap(bitmapData);
addChild(bitmap);
bitmap.x = 32;
bitmap.y = 32;
bitmap.bitmapData.lock();
for (var n:Number = 0; n < 360; n+=0.1) {
color.h = n;
for (var r:uint = 0; r < 202; r++) {
if (r < 100) {
color.s = r/100;
color.v = 1;
} else {
color.s = 1;
color.v = 2 - r/100;
}
var x:Number = 200 + r*Math.cos((n-90)*radian);
var y:Number = 200 + r*Math.sin((n-90)*radian);
bitmap.bitmapData.setPixel(x, y, color.value);
}
}
bitmap.bitmapData.unlock();
//
var overlay:Shape = new Shape();
overlay.graphics.beginFill(0x000000);
overlay.graphics.drawCircle(0, 0, 200);
overlay.graphics.endFill();
overlay.x = 232;
overlay.y = 232;
bitmap.mask = overlay;
}
}
}