rainbow
・どこかをクリックすると再描画
/**
* Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/uiOw6
*/
package {
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
public function FlashTest() {
redraw();
stage.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(e:MouseEvent):void {
redraw();
}
private function redraw():void {
var g:Graphics = this.graphics;
g.clear();
var rnd:Function = function():Number { return Math.random() * 465; };
var startX:Number = rnd();
var startY:Number = rnd();
var endX:Number = rnd();
var endY:Number = rnd();
var controlX:Number = rnd();
var controlY:Number = rnd();
var thickness:Number = 4.0;
var drawLine:Function = function(color:uint, offset:Number):void {
g.lineStyle(thickness, color);
g.moveTo(startX + offset, startY + offset);
g.curveTo(controlX, controlY, endX + offset, endY + offset);
};
drawLine(0xff4040, thickness * 0);
drawLine(0xffa040, thickness * 1);
drawLine(0xffff40, thickness * 2);
drawLine(0x40ff40, thickness * 3);
drawLine(0x40ffff, thickness * 4);
drawLine(0x40a0ff, thickness * 5);
drawLine(0x4040ff, thickness * 6);
}
}
}