forked from: ウォシュレット
/**
* Copyright motikawa_rgm ( http://wonderfl.net/user/motikawa_rgm )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/et2H
*/
// forked from asou_jp's ウォシュレット
package
{
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.geom.ColorTransform;
import flash.geom.Point;
[SWF(width="465", height="465", frameRate="60")]
/**
* 反省はしていない。
* http://ja.wikipedia.org/wiki/%E3%82%A6%E3%82%A9%E3%82%B7%E3%83%A5%E3%83%AC%E3%83%83%E3%83%88
*/
public class Main extends Sprite
{
public function Main():void
{
with(graphics)
{
beginFill(0)
drawRect(0,0,465,465);
endFill();
}
var oshiri:Oshiri = new Oshiri();
oshiri.x = stage.stageWidth >> 1;
oshiri.y = stage.stageHeight >> 1
addChild( oshiri );
oshiri.y -= 80;
_bitmap = new Bitmap( new BitmapData(465, 465, true, 0) );
addChild( _bitmap );
_bitmapData = _bitmap.bitmapData;
addEventListener( Event.ENTER_FRAME, _enterFrameHandler );
}
private function _enterFrameHandler(e:Event):void
{
_create();
_bitmapData.lock();
_bitmapData.colorTransform( _bitmapData.rect, new ColorTransform(1, 1, 1, 0.95));
_bitmapData.applyFilter( _bitmapData,_bitmapData.rect,new Point(), new BlurFilter(5,5,3) );
var len:int = _dots.length;
for ( var i:int = len-1; i >=0 ; i--)
{
var dot:MyPoint = _dots[i] as MyPoint;
_bitmapData.setPixel32( dot.x, dot.y, dot.color);
dot.x += dot.xv;
dot.y += dot.yv;
dot.xv *= 0.95;
dot.yv += 0.1;
if ( dot.y < 145 ) {
dot.xv = Math.random() * 16 -8;
dot.yv = Math.random() * 5;
}
if ( dot.y > 465 ) _dots.splice(i, 1);
}
_bitmapData.unlock();
}
private function _create():void
{
for ( var i:int = 0; i < _loop; i++ )
{
_dots.push( new MyPoint() );
}
}
private var _loop:int = 30;
private var _dots:/*MyPoint*/Array = [];
private var _bitmapData:BitmapData;
private var _bitmap:Bitmap;
}
}
internal class MyPoint
{
public function MyPoint()
{
xv = Math.random() * 3 - 1.5;
yv = (Math.random() * 20) - 10;
x = Math.random()*5 + 230;
y = 145;
}
public var color:uint = 0xFFFF4444;
public var xv:Number;
public var yv:Number;
public var x:Number;
public var y:Number;
}
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
internal class Oshiri extends Sprite
{
private const _SIZE:Number = 100;
private const LINE_COLOR:uint = 0x666666;
private const FILL_COLOR:uint = 0xF8E0C6;
public function Oshiri():void
{
with (graphics)
{
lineStyle( 10, LINE_COLOR );
beginFill(FILL_COLOR)
drawCircle( -100, -100, 125 );
endFill()
beginFill(FILL_COLOR)
drawCircle( 100, -100, 125 );
endFill()
lineStyle(0, 0, 0);
beginFill(FILL_COLOR);
drawRect( -150, -400, 300, 375 );
endFill();
}
}
}