flash on 2011-6-29
アンドロイドでなんかこんなのがあった気が
/**
* Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9Qi9
*/
//アンドロイドでなんかこんなのがあった気が
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.*;
import flash.geom.*;
import caurina.transitions.Tweener;
[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
public class wait_adrd extends Sprite{
private var container:Sprite= new Sprite();
private var baseSP:Sprite= new Sprite();
private var bmpd:BitmapData = new BitmapData(465,465, false, 0xFF000000 );
private var colorTransform:ColorTransform = new ColorTransform(0.99, 0.99, 0.99);
private var myArray:Array=new Array();
private var cnt:uint=0;
public function wait_adrd(){
if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );
}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
stage.addEventListener(MouseEvent.MOUSE_DOWN, clicks);
addChild(new Bitmap(bmpd));
container.addChild(baseSP);
setBg();
setclickRecton();
addEventListener(Event.ENTER_FRAME, render);
}
private function setRecton():void {
var sh:drawRecton=new drawRecton();
baseSP.addChild(sh);
}
private function setBg():void {
var pt:BitmapData = setBitmapFill();
var bg:Sprite = new Sprite();
bg.graphics.beginBitmapFill(pt);
bg.graphics.drawRect(0, 0, 465, 465);
bg.graphics.endFill();
addChild(bg);
bg.alpha=0.5;
}
private function setBitmapFill():BitmapData{
var pattern:Array= [[0,1,1,1,1,1,2],[0,0,1,1,1,2,2],[0,0,0,1,2,2,2],[0,0,0,0,2,2,2],[0,0,0,3,2,2,2],[0,0,3,3,3,2,2],[0,3,3,3,3,3,2]];
var colors:Array=[0xff666666, 0xff222222,0xff444444,0xff888888];
var bitmapW:int = pattern[0].length;
var bitmapH:int = pattern.length;
var bmd:BitmapData = new BitmapData(bitmapW,bitmapH,true,0x000000);
for(var yy:int=0; yy<bitmapH; yy++){
for(var xx:int=0; xx<bitmapW; xx++){
var color:int = colors[pattern[yy][xx]];
bmd.setPixel32(xx, yy, color);
}
}
return bmd;
}
private function render(ev){
if(cnt==100){
cnt=0;
setRecton();
}else{cnt++;}
bmpd.lock();
//ちょっとづつ暗くする
bmpd.colorTransform( bmpd.rect, colorTransform );
bmpd.draw(container);
bmpd.unlock();
}
private function setclickRecton(){
for(var q:int=0; q<4; q++){
var cl:clickRecton=new clickRecton(q);
cl.x=cl.y=-100;
myArray.push(cl);
baseSP.addChild(cl);
}
}
private function clicks(ev){
var xinfo:uint=Math.floor(mouseX/7)*7;
var yinfo:uint=Math.floor(mouseY/7)*7;
var times:uint=5;
myArray[0].x=xinfo;
myArray[0].y=yinfo;
Tweener.addTween(myArray[0],{y:1000,time:times,transition:'linear'});
myArray[1].x=xinfo;
myArray[1].y=yinfo;
Tweener.addTween(myArray[1],{x:-1000,time:times,transition:'linear'});
myArray[2].x=xinfo;
myArray[2].y=yinfo;
Tweener.addTween(myArray[2],{x:1000,time:times,transition:'linear'});
myArray[3].x=xinfo;
myArray[3].y=yinfo;
Tweener.addTween(myArray[3],{y:-1000,time:times,transition:'linear'});
}
}
}
import flash.display.Sprite;
import caurina.transitions.Tweener;
class drawRecton extends Sprite{
private var colorList:Array=[[0x018496,0x21B2DE],[0xFFCC00,0xFFCC00],[0x72AA00,0x00CC00],[0xFF0044,0xFF0000]]//0xFF4074,0xFB5E79//0xFF4074,0xF92850
public function drawRecton( ){
var rnd:uint=Math.floor(Math.random()*4);
var rnd2:uint=Math.floor(Math.random()*4);
var rc:Sprite=new Sprite();
rc.graphics.beginFill(colorList[rnd][0]);
rc.graphics.drawRect(0,0,7,7);
rc.graphics.endFill();
rc.graphics.beginFill(colorList[rnd][1]);
rc.graphics.drawRect(1,1,5,5);
rc.graphics.endFill();
addChild(rc);
var times:uint=5;
switch (rnd2) {
case 0:
rc.x=Math.floor(Math.random()*66)*7;
rc.y=0;
Tweener.addTween(rc,
{
y : 470,
time : times,
transition:'linear',
onComplete : function():void{removeChild(rc);rc=null;}
});
break;
case 1:
rc.x=470;
rc.y=Math.floor(Math.random()*66)*7;
Tweener.addTween(rc,
{
x : 0,
time : times,
transition:'linear',
onComplete : function():void{removeChild(rc);rc=null;}
});
break;
case 2:
rc.x=0;
rc.y=Math.floor(Math.random()*66)*7;
Tweener.addTween(rc,
{
x : 470,
time : times,
transition:'linear',
onComplete : function():void{removeChild(rc);rc=null;}
});
break;
case 3:
rc.x=Math.floor(Math.random()*66)*7;
rc.y=470;
Tweener.addTween(rc,
{
y : 0,
time : times,
transition:'linear',
onComplete : function():void{removeChild(rc);rc=null;}
});
break;
default:
;
break;
}
}
}
class clickRecton extends Sprite{
private var colorList:Array=[[0xFF0044,0xFF0000],[0x72AA00,0x00CC00],[0xFFCC00,0xFFCC00],[0x018496,0x21B2DE]];
public function clickRecton(arg:uint){
this.graphics.beginFill(colorList[arg][0]);
this.graphics.drawRect(0,0,7,7);
this.graphics.endFill();
this.graphics.beginFill(colorList[arg][1]);
this.graphics.drawRect(1,1,5,5);
this.graphics.endFill();
}
}