beet-noise
音はこちらから
http://www.ektoplazm.com/2010/eugenism
fullscreenで作りたかったんですが重すぎるので無理・・
package {
//音はこちらから
//http://www.ektoplazm.com/2010/eugenism
//fullscreenで作りたかったんですが重すぎるので無理・・
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.display.Sprite;
import caurina.transitions.properties.DisplayShortcuts;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;
import flash.display.BlendMode;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.ConvolutionFilter;
import flash.filters.DisplacementMapFilter;
import flash.filters.DisplacementMapFilterMode;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;
import flash.net.URLRequest;
import flash.system.Security;
import flash.utils.ByteArray;
import flash.events.Event;
import flash.filters.BlurFilter;
[SWF(backgroundColor="#dfa688",frameRate=30)]
public class Main extends MovieClip {
private var bmd:BitmapData;
private var bmd1:BitmapData;
private var offsets:Array;
private var bm1:Bitmap;
private var bm2:Bitmap;
private var bm3:Bitmap;
private var offnum1:Number;
private var offnum2:Number;
private var pernum:Number;
private var flg:Boolean=true;
private var alhnum:Number=0.5;
private var rot:int;
private var roty:Number;
private var rotx:Number;
private var mat:Matrix;
private var s:Sprite;
private var s1:Sprite;
private var bmds:BitmapData;
private var bms:Bitmap;
private var lowBoder:Number=100;
private var highBorder:Number=200;
private var grayFlag:int =Math.floor(Math.random()*2)-1;
private var perlinbaseX:Number;
private var perlinbaseY:Number;
private var mySound:Sound;
private var cou:int=0;
private var bytes:ByteArray;
private var thh1:String;
private var thh2:String;
private var ths1:uint;
private var ths2:uint;
private var thv1:uint;
private var thv2:uint;
private var pt:int=0;
private var mc:MovieClip;
private var fil:BlurFilter;
private var rect:Rectangle;
private var p:Point;
private var rf:Number;
private var count:int;
private var txt:TextField;
public function Main() {
txt = new TextField();
txt.textColor=0xff0000;
rf=0;
rect=new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
p=new Point(0,0);
mc = new MovieClip();
mc.x=stage.stageWidth/2;
mc.y=stage.stageHeight/2;
bytes = new ByteArray();
count=0;
mat=new Matrix(-1,0,0,1,stage.stageWidth,0);
bmd1=new BitmapData(stage.stageWidth + 20,stage.stageHeight,false,0xffffff);
offsets = new Array(new Point(), new Point());
bmd=new BitmapData(stage.stageWidth/2 + 1,stage.stageHeight,false,0xffffff);
bm1=new Bitmap(bmd);
bm2=new Bitmap(bmd);
bm2.scaleX=-1;
bmd1.draw(bm1);
bmd1.draw(bm2);
bm3=new Bitmap(bmd1);
addChild(mc);
mc.addChild(bm3);
bm3.x-=stage.stageWidth/2;
bm3.y-=stage.stageHeight/2;
var blur:BlurFilter=new BlurFilter(8,8,2);
s = new Sprite();
s.graphics.beginFill(0xffffff);
s.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
s.graphics.endFill();
bmds=new BitmapData(stage.stageWidth,stage.stageHeight);
bmds.draw(s);
bms=new Bitmap(bmds);
addChild(bms);
bms.blendMode=BlendMode.HARDLIGHT;
bms.alpha=0.1;
s1 = new Sprite();
s1.graphics.beginFill(0xffffff);
s1.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
s1.graphics.endFill();
addChild(s1);
s1.blendMode=BlendMode.ADD;
s1.alpha=0.8;
fil=new BlurFilter(8,8);
mc.filters=[fil];
nums();
addChild(txt);
Security.loadPolicyFile("http://mutast.heteml.jp/crossdomain.xml");
mySound = new Sound();
mySound.load(new URLRequest("http://mutast.heteml.jp/works/music/music3.mp3"));
mySound.addEventListener(Event.COMPLETE, init);
mySound.addEventListener(ProgressEvent.PROGRESS, info);
}
public function info(e:ProgressEvent):void {
var num1:int=int(mySound.bytesLoaded/mySound.bytesTotal*100);
txt.text=String(num1)+"/100";
}
public function init(e:Event):void {
removeChild(txt);
var channel:SoundChannel = new SoundChannel();
channel=mySound.play();
addEventListener(Event.ENTER_FRAME, loop);
}
public function loop(evt:Event):void {
s1.alpha-=0.05;
if (bms.alpha<0.7) {
bms.alpha+=0.005;
}
cou++;
count=0;
bytes.position=0;
SoundMixer.computeSpectrum(bytes, false, 0);
for (var q:int = 0; bytes.bytesAvailable >= 4; q++) {
rf=bytes.readFloat();
var t:Number=Math.abs(rf);
if (t>=0.4&&q>256) {
count++;
}
if (count>=120) {
if (cou>5) {
numset();
cou=0;
}
}
}
offsets[0].y+=offnum1;
offsets[1].x+=offnum2;
bmd.perlinNoise(perlinbaseX, perlinbaseY, 2, pernum, false, false, 7, true, offsets);
bmd.threshold(bmd, rect, p,thh1, ths1, thv1, 0xffffffff, true);
bmd.threshold(bmd, rect, p,thh2, ths2, thv2, 0xffffffff, true);
bmds.noise(Math.random()*50,lowBoder,highBorder,7,true);
bmd1.draw(bm1);
bmd1.draw(bm2, mat);
if (mc.scaleX<1.3) {
mc.scaleX+=0.006;
mc.scaleY+=0.006;
}
}
public function nums():void {
s1.alpha=1;
thh1="<";
thh2=">";
ths1=0xff222222;
ths2=0xff444444;
thv1=0xff000000;
thv2=0xffffffff;
offnum1=Math.floor(Math.random()*10)/10-0.5;
offnum2=Math.floor(Math.random()*10)/10-0.5;
pernum=Math.random()*100;
perlinbaseX=Math.floor(Math.random()*100)+100;
perlinbaseY=Math.floor(Math.random()*100)+100;
lowBoder=100;
highBorder=200;
}
public function numset():void {
s1.alpha=1;
do {
var num:int=Math.floor(Math.random()*5);
} while (pt == num);
pt=num;
if (pt==0) {
mc.scaleX=1;
mc.scaleY=1;
thh1="<";
thh2=">";
ths1=0xff222222;
ths2=0xff444444;
thv1=0xff000000;
thv2=0xffffffff;
offnum1=Math.floor(Math.random()*10)/10-0.5;
offnum2=Math.floor(Math.random()*10)/10-0.5;
offnum1=offnum1!=0?offnum1:0.2;
offnum2=offnum2!=0?offnum2:0.2;
pernum=Math.random()*100;
perlinbaseX=Math.floor(Math.random()*100)+100;
perlinbaseY=Math.floor(Math.random()*100)+100;
bms.alpha=0.2;
} else if (pt == 1) {
mc.scaleX=1;
mc.scaleY=1;
thh1="<";
thh2=">";
ths1=0xff222222;
ths2=0xff222222;
thv1=0xff000000;
thv2=0xffffffff;
offnum1=Math.floor(Math.random()*10)/10-0.5;
offnum2=Math.floor(Math.random()*10)/10-0.5;
offnum1=offnum1!=0?offnum1:0.2;
offnum2=offnum2!=0?offnum2:0.2;
pernum=Math.random()*100;
perlinbaseX=Math.floor(Math.random()*80)+50;
perlinbaseY=Math.floor(Math.random()*80)+50;
bms.alpha=0.2;
} else if (pt == 2) {
mc.scaleX=1;
mc.scaleY=1;
thh1="<";
thh2=">";
ths1=0xff222222;
ths2=0xff555555;
thv1=0xff000000;
thv2=0xffffffff;
offnum1=Math.floor(Math.random()*10)/10-0.5;
offnum2=Math.floor(Math.random()*10)/10-0.5;
offnum1=offnum1!=0?offnum1:0.2;
offnum2=offnum2!=0?offnum2:0.2;
pernum=Math.random()*100;
perlinbaseX=Math.floor(Math.random()*80)+100;
perlinbaseY=Math.floor(Math.random()*80)+100;
bms.alpha=0.2;
} else if (pt == 3) {
mc.scaleX=1;
mc.scaleY=1;
thh1="<";
thh2=">";
ths1=0xff222222;
ths2=0xff444444;
thv1=0xff000000;
thv2=0xffffffff;
offnum1=Math.floor(Math.random()*10)/10-0.5;
offnum2=Math.floor(Math.random()*10)/10-0.5;
offnum1=offnum1!=0?offnum1:0.2;
offnum2=offnum2!=0?offnum2:0.2;
pernum=Math.random()*100;
perlinbaseX=Math.floor(Math.random()*80)+100;
perlinbaseY=Math.floor(Math.random()*80)+100;
bms.alpha=0.2;
} else if (pt == 4) {
thh1="<";
thh2=">";
thv2=0xff000000;
thv1=0xffffffff;
}
}
}
}