| 1 |
package |
|---|
| 2 |
{ |
|---|
| 3 |
import com.nitoyon.potras.*; |
|---|
| 4 |
import flash.display.*; |
|---|
| 5 |
import flash.filters.*; |
|---|
| 6 |
import flash.geom.*; |
|---|
| 7 |
import flash.events.*; |
|---|
| 8 |
import flash.utils.*; |
|---|
| 9 |
import caurina.transitions.Tweener; |
|---|
| 10 |
|
|---|
| 11 |
[SWF(width="710", height="473", backgroundColor="#ffffff")] |
|---|
| 12 |
public class Seizou extends Sprite |
|---|
| 13 |
{ |
|---|
| 14 |
[Embed(source='assets/photo3.jpg')] |
|---|
| 15 |
private var Air:Class; |
|---|
| 16 |
|
|---|
| 17 |
private static const MARGIN:int = 10; |
|---|
| 18 |
|
|---|
| 19 |
private var bmd:BitmapData; |
|---|
| 20 |
private var colors:Array = [0xff333333, 0xff666666, 0xff808080, 0xff999999, 0xffcccccc, 0xffeeeeee]; |
|---|
| 21 |
|
|---|
| 22 |
public function Seizou() |
|---|
| 23 |
{ |
|---|
| 24 |
var bmp:Bitmap = new Air(); |
|---|
| 25 |
bmd = bmp.bitmapData; |
|---|
| 26 |
var cmf:ColorMatrixFilter = new ColorMatrixFilter( |
|---|
| 27 |
[1 / 3, 1 / 3, 1 / 3, 0, 0, |
|---|
| 28 |
1 / 3, 1 / 3, 1 / 3, 0, 0, |
|---|
| 29 |
1 / 3, 1 / 3, 1 / 3, 0, 0] |
|---|
| 30 |
); |
|---|
| 31 |
bmd.applyFilter(bmd, bmd.rect, new Point(), cmf); |
|---|
| 32 |
addChild(new Bitmap(bmd)); |
|---|
| 33 |
|
|---|
| 34 |
graphics.beginFill(0); |
|---|
| 35 |
graphics.drawRect(bmd.width + MARGIN, 0, bmd.width, bmd.height); |
|---|
| 36 |
graphics.endFill(); |
|---|
| 37 |
|
|---|
| 38 |
loop(); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
private function loop():void |
|---|
| 42 |
{ |
|---|
| 43 |
var color:uint = colors.shift(); |
|---|
| 44 |
|
|---|
| 45 |
var bmdtmp:BitmapData = new BitmapData(bmd.width, bmd.height); |
|---|
| 46 |
bmdtmp.threshold(bmd, bmd.rect, new Point(), ">=", color, 0xff000000); |
|---|
| 47 |
var bmptmp:Bitmap = new Bitmap(bmdtmp.clone()); |
|---|
| 48 |
bmptmp.bitmapData.colorTransform(bmd.rect, new ColorTransform(1, 1, 1, 1, color & 0xff, color & 0xff, color & 0xff)); |
|---|
| 49 |
|
|---|
| 50 |
addChild(bmptmp); |
|---|
| 51 |
bmptmp.alpha = 0.2; |
|---|
| 52 |
Tweener.addTween(bmptmp, { |
|---|
| 53 |
time : 1.5, |
|---|
| 54 |
y : bmdtmp.height + MARGIN, |
|---|
| 55 |
alpha : 1, |
|---|
| 56 |
onComplete : function():void{ |
|---|
| 57 |
var c:ClosedPathList = PotrAs.traceBitmap(bmdtmp); |
|---|
| 58 |
|
|---|
| 59 |
var s:Sprite = new Sprite(); |
|---|
| 60 |
s.graphics.lineStyle(.5, 0); |
|---|
| 61 |
s.graphics.beginFill(color); |
|---|
| 62 |
c.draw(s.graphics); |
|---|
| 63 |
s.graphics.endFill(); |
|---|
| 64 |
addChild(s); |
|---|
| 65 |
s.x = bmd.width + MARGIN; |
|---|
| 66 |
s.y = bmd.height + MARGIN; |
|---|
| 67 |
s.alpha = 0; |
|---|
| 68 |
|
|---|
| 69 |
setTimeout(function():void{ |
|---|
| 70 |
Tweener.addTween(s, { |
|---|
| 71 |
time : 1.5, |
|---|
| 72 |
alpha : 1 |
|---|
| 73 |
}) |
|---|
| 74 |
Tweener.addTween(s, { |
|---|
| 75 |
time : 1.5, |
|---|
| 76 |
y : 0, |
|---|
| 77 |
delay : 1.8, |
|---|
| 78 |
onComplete : function():void{ |
|---|
| 79 |
if(colors.length){ |
|---|
| 80 |
setTimeout(loop, 500); |
|---|
| 81 |
} |
|---|
| 82 |
} |
|---|
| 83 |
}); |
|---|
| 84 |
}, 100);; |
|---|
| 85 |
} |
|---|
| 86 |
}); |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
} |
|---|