Rectangular Wave 1
http://cafe.naver.com/tracefl/2416
package {
import flash.filters.ColorMatrixFilter;
import flash.events.Event;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Sprite;
public class Rect extends Sprite {
public function Rect() {
const changeVar:Number = 0.08;
var myRect:Sprite = new Sprite();
myRect.graphics.beginFill(0x000000);
myRect.graphics.drawRect(0,0,50,50);
for(var i:uint=0;i<12;i++){
for(var j:uint=0;j<10;j++){
var myM:Sprite = new Sprite();
var myGD:BitmapData = new BitmapData(50,50);
myGD.draw(myRect);
var myGrp:Bitmap = new Bitmap(myGD);
myM.x = 25+50*i;
myM.y = 25+50*j;
myGrp.scaleX = ((i*12+j)/10)%1;
myGrp.scaleY = myGrp.scaleX;
myGrp.addEventListener("enterFrame",efHandler);
myM.addChild(myGrp);
addChild(myM);
}
}
function efHandler(e:Event):void{
e.target.scaleX += changeVar;
var n:Number = e.target.scaleX;
if(n > 1){
e.target.scaleX = changeVar;
}
var r:Number = Math.abs(0.4-n);
var g:Number = (0.5+n)%1;
var b:Number = Math.abs((0.7-n)/2);
var cF:ColorMatrixFilter = new ColorMatrixFilter([1,b,g,r,0 , 0,1,b,g,r , r,0,1,b,g , g,r,0,1,b]);
e.target.filters = [cF];
e.target.x = -25*n;
e.target.y = -25*n;
e.target.scaleY = n;
}
}
}
}