package { import com.nitoyon.potras.*; import flash.display.*; import flash.filters.*; import flash.geom.*; import flash.events.*; import flash.utils.*; import caurina.transitions.Tweener; [SWF(width="710", height="473", backgroundColor="#ffffff")] public class Seizou extends Sprite { [Embed(source='assets/photo3.jpg')] private var Air:Class; private static const MARGIN:int = 10; private var bmd:BitmapData; private var colors:Array = [0xff333333, 0xff666666, 0xff808080, 0xff999999, 0xffcccccc, 0xffeeeeee]; public function Seizou() { var bmp:Bitmap = new Air(); bmd = bmp.bitmapData; var cmf:ColorMatrixFilter = new ColorMatrixFilter( [1 / 3, 1 / 3, 1 / 3, 0, 0, 1 / 3, 1 / 3, 1 / 3, 0, 0, 1 / 3, 1 / 3, 1 / 3, 0, 0] ); bmd.applyFilter(bmd, bmd.rect, new Point(), cmf); addChild(new Bitmap(bmd)); graphics.beginFill(0); graphics.drawRect(bmd.width + MARGIN, 0, bmd.width, bmd.height); graphics.endFill(); loop(); } private function loop():void { var color:uint = colors.shift(); var bmdtmp:BitmapData = new BitmapData(bmd.width, bmd.height); bmdtmp.threshold(bmd, bmd.rect, new Point(), ">=", color, 0xff000000); var bmptmp:Bitmap = new Bitmap(bmdtmp.clone()); bmptmp.bitmapData.colorTransform(bmd.rect, new ColorTransform(1, 1, 1, 1, color & 0xff, color & 0xff, color & 0xff)); addChild(bmptmp); bmptmp.alpha = 0.2; Tweener.addTween(bmptmp, { time : 1.5, y : bmdtmp.height + MARGIN, alpha : 1, onComplete : function():void{ var c:ClosedPathList = PotrAs.traceBitmap(bmdtmp); var s:Sprite = new Sprite(); s.graphics.lineStyle(.5, 0); s.graphics.beginFill(color); c.draw(s.graphics); s.graphics.endFill(); addChild(s); s.x = bmd.width + MARGIN; s.y = bmd.height + MARGIN; s.alpha = 0; setTimeout(function():void{ Tweener.addTween(s, { time : 1.5, alpha : 1 }) Tweener.addTween(s, { time : 1.5, y : 0, delay : 1.8, onComplete : function():void{ if(colors.length){ setTimeout(loop, 500); } } }); }, 100);; } }); } } }