Flicker
Attention! 目がチカチカします!
/**
* Copyright hrtsgt ( http://wonderfl.net/user/hrtsgt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rKNk
*/
package{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
[SWF(width=465, height=465, backgroundColor=0xFFFFFF)]
/* Attention! 目がチカチカします! */
public class Flicker extends Sprite{
private var ary:Array;
public function Flicker(){
setup();//
var s:Sprite = new Sprite();
s.graphics.lineStyle( 1.5, 0x0, 1, true);
for(var i:uint=0; i<=stage.stageWidth*2; i+=5){
s.graphics.moveTo( i, 0);
s.graphics.lineTo( 0, i);
}
var stripe:BitmapData = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0xFFFFFF);
stripe.draw(s);
addChild( new Bitmap(stripe) );
var bmpd:BitmapData = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0xFFFFFF);
var m:Matrix = new Matrix();
m.scale( -1, 1);
m.translate( stripe.width, 0);
bmpd.draw( stripe, m);
var bmp:Bitmap = addChild( new Bitmap(bmpd) ) as Bitmap;
var mask:Sprite = new Sprite();
for(i=0; i<ary.length; i++){
var shape:Shape = ary[i];
mask.addChild( shape );
shape.x = i%3 == 0 ? 0 : ary[i-1].x + ary[i-1].width + 1;
shape.y = Math.floor(i/3)*6;
}
mask.scaleX = mask.scaleY = 20;
mask.x = 60;
mask.y = 60;
addChild( mask );
bmp.mask = mask;
}
private function setup():void{
ary = [];
var s:Shape = new Shape();
var g:Graphics = s.graphics;
//W
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 4);
g.drawRect( 3, 0, 1, 4);
g.drawRect( 6, 0, 1, 4);
g.drawRect( 0, 4, 7, 1);
ary.push(s);
//O
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 3, 0, 1, 5);
g.drawRect( 1, 0, 2, 1);
g.drawRect( 1, 4, 2, 1);
ary.push(s);
//N
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 3, 0, 1, 5);
g.drawRect( 1, 0, 2, 1);
ary.push(s);
//D
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 3, 1, 1, 3);
g.drawRect( 1, 0, 2, 1);
g.drawRect( 1, 4, 2, 1);
ary.push(s);
//E
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 1, 0, 3, 1);
g.drawRect( 1, 2, 3, 1);
g.drawRect( 1, 4, 3, 1);
ary.push(s);
//R
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 1, 0, 3, 1);
g.drawRect( 3, 1, 1, 1);
g.drawRect( 1, 2, 2, 1);
g.drawRect( 3, 3, 1, 2);
ary.push(s);
//F
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 1, 0, 3, 1);
g.drawRect( 1, 2, 3, 1);
ary.push(s);
//L
s = new Shape();
g = s.graphics
g.beginFill(0x0);
g.drawRect( 0, 0, 1, 5);
g.drawRect( 1, 4, 3, 1);
ary.push(s);
}
}
}