flash on 2011-5-11
...
@author gaina
/**
* Copyright gaina ( http://wonderfl.net/user/gaina )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9sNw
*/
package
{
import caurina.transitions.Tweener;
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author gaina
*/
public class Main extends Sprite
{
private var SIZE:int = 13;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var hh:int = Math.ceil(stage.stageHeight / SIZE);
for (var i:int = 1; i < hh; i += 2) {
var s:Sprite = new Sprite();
s.graphics.beginFill(0);
s.graphics.drawRect(0, 0, stage.stageWidth, SIZE);
s.graphics.endFill();
addChild(s);
s.y = i * SIZE;
s.scaleX = 0;
test(s, i, hh);
}
var ww:int = Math.ceil(stage.stageWidth / SIZE);
for (var j:int = 1; j < ww; j += 2) {
var _s:Sprite = new Sprite();
_s.graphics.beginFill(0);
_s.graphics.drawRect(0, 0, SIZE, stage.stageHeight);
_s.graphics.endFill();
addChild(_s);
_s.x = stage.stageWidth - (j * SIZE);
_s.scaleY = 0;
test(_s, j, ww);
}
}
private function test(s:Sprite, i:int, num:Number):void
{
Tweener.addTween(s, {
scaleX:1,
scaleY:1,
time:1,
delay:i * 0.1,
onComplete:function():void {
Tweener.addTween(s, { scaleX:0, scaleY:0, time:0.7, delay:(num + i) * 0.05 } );
}
} );
}
}
}