ColorCircle (1)
無理矢理感満載でお届けします。
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6wDM
*/
////////////////////////////////////////////////////////////////////////////////
// ColorCircle (1)
////////////////////////////////////////////////////////////////////////////////
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, true, 0x00000000);
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++) {
color.s = r/200;
var x:Number = 200 + r*Math.cos((n-90)*radian);
var y:Number = 200 + r*Math.sin((n-90)*radian);
bitmap.bitmapData.setPixel32(x, y, 0xFF << 24 | 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;
}
}
}