forked from: Noize
ドットスクリーンを貼ってみました。for theEMBEDgroup(OneInchPunch090330)
**********************************************
code by yonedashigeru
http://wab.cc/
**********************************************
// forked from yonedashigeru's Noize
// ドットスクリーンを貼ってみました。for theEMBEDgroup(OneInchPunch090330)
//**********************************************
//
// code by yonedashigeru
//
// http://wab.cc/
//
//**********************************************
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import caurina.transitions.Tweener;
import flash.system.Capabilities;
public class Main extends Sprite{
public var cover_sp:Sprite;
private var r_bmd:BitmapData;
private var r_bm:Bitmap;
private var g_bmd:BitmapData;
private var g_bm:Bitmap;
private var b_bmd:BitmapData;
private var b_bm:Bitmap;
private var target:TextField;
private var mod:String;
private var noise_map:Array;
private var map_num:int = 3;
private var dfil:DisplacementMapFilter;
public var delay:Number = 100;
/*======================================================================*//**
* コンストラクタ
*/
public function Main()
{
target = new TextField();
target.text = "theEMBEDgroup";
var _tf:TextFormat = new TextFormat();
_tf.size = 62;
_tf.color = 0x000000;
target.setTextFormat(_tf);
target.autoSize = TextFieldAutoSize.LEFT;
mod = BlendMode.DARKEN;
var tmp_w:Number = target.width;
var tmp_h:Number = target.height;
r_bmd = new BitmapData(tmp_w, tmp_h, true, 0);
r_bmd.draw(target, null, null, null, null, true);
r_bm = new Bitmap(r_bmd);
r_bm.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 255, 255, 0);
r_bm.blendMode = mod;
g_bmd = new BitmapData(tmp_w, tmp_h, true, 0);
g_bmd.draw(target, null, null, null, null, true);
g_bm = new Bitmap(g_bmd);
g_bm.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 255, 0, 255, 0);
g_bm.blendMode = mod;
b_bmd = new BitmapData(tmp_w, tmp_h, true, 0);
b_bmd.draw(target, null, null, null, null, true);
b_bm = new Bitmap(b_bmd);
b_bm.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 255, 255, 0, 0);
b_bm.blendMode = mod;
cover_sp = new Sprite();
cover_sp.addChild(r_bm);
cover_sp.addChild(g_bm);
cover_sp.addChild(b_bm);
cover_sp.x = (stage.stageWidth - cover_sp.width) / 2;
cover_sp.y = (stage.stageHeight - cover_sp.height) / 2;
addChild(cover_sp);
start();
}
/*======================================================================*//**
* start
*/
public function start():void
{
createNoise();
dfil = new DisplacementMapFilter(null, new Point(0,0), BitmapDataChannel.RED, BitmapDataChannel.RED, 5, 0);
cover_sp.filters = [dfil];
cover_sp.addEventListener(Event.ENTER_FRAME, onEnter);
// added by OneInchPunch
xScreen();
}
private var tm_index:int = 0;
/*======================================================================*//**
* onEnter
*/
private function onEnter(e:Event) :void
{
var tmp_fill:DisplacementMapFilter = cover_sp.filters[0];
var tmp_num:int = Math.floor(Math.random() * noise_map.length);
tmp_fill.mapBitmap = noise_map[tmp_num];
cover_sp.filters = [tmp_fill];
r_bm.x = Math.random() * 10 - 5;
g_bm.x = Math.random() * 10 - 5;
b_bm.x = Math.random() * 10 - 5;
}
/*======================================================================*//**
* createNoise
*/
private function createNoise() :void
{
noise_map = new Array();
for(var i:int=0; i<map_num; i++)
{
var tmp_bmd:BitmapData = new BitmapData(target.width, target.height, false, 0x808080);
tmp_bmd.noise(Math.floor(Math.random() * 10), 0, 255, 7, true);
for(var j:int=0; j<tmp_bmd.width; j++)
{
tmp_bmd.scroll(1, 0);
}
noise_map.push(tmp_bmd);
}
}
// added by OneInchPunch
// ====================================================================== xScreen
private function xScreen():void {
// ビットマップデータ及び模様の作成
var dot_bmd :BitmapData = new BitmapData(3, 3, true, 0x00FFFFFF);
dot_bmd.setPixel32(0, 0, 0x77000000);
dot_bmd.setPixel32(0, 1, 0xff000000);
dot_bmd.setPixel32(0, 2, 0x77000000);
dot_bmd.setPixel32(1, 0, 0xff000000);
dot_bmd.setPixel32(1, 1, 0xff000000);
dot_bmd.setPixel32(1, 2, 0xff000000);
dot_bmd.setPixel32(2, 0, 0x77000000);
dot_bmd.setPixel32(2, 1, 0xff000000);
dot_bmd.setPixel32(2, 2, 0x77000000);
var dotScreen:Sprite = new Sprite();
dotScreen.graphics.beginBitmapFill(dot_bmd);
dotScreen.graphics.drawRect(0, 0, Capabilities.screenResolutionX, Capabilities.screenResolutionY);
dotScreen.graphics.endFill();
dotScreen.alpha = 0.7;
addChild(dotScreen);
}
}
}