やる気ねぇマウスカーソル
マウスカーソルをのっけるとやる気ない感じで溶けます
たったこれだけの処理にプログラム書きすぎ。
please put a mousecursor on the stage,beforeやる気ねえ.英語わかんねぇ…
//マウスカーソルをのっけるとやる気ない感じで溶けます
//たったこれだけの処理にプログラム書きすぎ。
//please put a mousecursor on the stage,beforeやる気ねえ.英語わかんねぇ…
package {
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.system.LoaderContext;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.ui.Mouse;
import flash.geom.Rectangle;
import flash.geom.Point;
import flash.filters.BlurFilter;
[SWF(width = "465", height = "465", frameRate = "60", backgroundColor = "#000000")]
public class FlashTest extends Sprite {
private var bmd_all:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0xFF000000);
private var bm_all:Bitmap = new Bitmap(bmd_all);
private var bmd_cur:BitmapData;
private var bm_cur:Bitmap;
private var pnt_cur:Point = new Point(0,0);
private var rect_cur:Rectangle = new Rectangle(0,0,0,0);
private var blur:BlurFilter = new BlurFilter(1.5,1.2);
private var count:int = 0;
private var wait:int = 0;
private var flag_start:Boolean = false;
private var tr:TraceSet = new TraceSet;
public function FlashTest() {
// write as3 code here..
_initFunc();
_initAdd();
}
private function _initFunc():void{
stage.addChild(bm_all);
tr.width = stage.stageWidth;
_loadFunc();
Mouse.hide();
}
private function _initAdd():void{
stage.addEventListener(MouseEvent.MOUSE_MOVE,_mouseMove);
}
private function _mouseMove(event:Event):void{
wait = 0;
flag_start = true;
bm_cur.visible = true;
stage.addChild(bm_cur);
}
private function _loadFunc():void{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,_loadComp);
loader.load(
new URLRequest("http://assets.wonderfl.net/images/related_images/c/c7/c77d/c77d45a2e01b6f665c4d11d012a35856b846a4db"),
new LoaderContext(true)
);
}
private function _loadComp(event:Event):void{
bmd_cur = Bitmap(Loader(event.currentTarget.loader).content).bitmapData;
bm_cur = new Bitmap(bmd_cur);
bm_cur.x = -100;//はじめは隠しとく
stage.addChild(bm_cur);
stage.addChild(bm_all);
bm_cur.visible = false;
stage.addEventListener(Event.ENTER_FRAME,_entFunc);
}
private function _entFunc(event:Event):void{
if(flag_start){
with(bm_cur){ //マウスカーソル追従
x = stage.mouseX;
y = stage.mouseY;
}
if(wait < 60){
wait ++;
stage.addChild(bm_cur);
tr.trace("\キリッ/");
}else if(wait == 60){
wait = 100;
stage.addChild(bm_all);
stage.addChild(tr);
tr.trace("\あーもうやる気ねぇ/");
_drawPict();
}
count ++;
if(count > 2){ //ちょっと重たいので3フレームに1回実行
count = 0;
_blurFilt();
}
}
}
private function _drawPict():void{
pnt_cur = new Point(bm_cur.x,bm_cur.y);
rect_cur = new Rectangle(0,0,bmd_cur.width,bmd_cur.height);
//コピー元、コピー元範囲、コピー先の座標、ぬる、ぬる、透過あり
bmd_all.copyPixels(bmd_cur,rect_cur,pnt_cur,null,null,true);
}
private function _blurFilt():void{
bmd_all.applyFilter(bmd_all, bmd_all.rect, bmd_all.rect.topLeft, blur);
}
}
}
/*///////////////////////////////////////////////////////
//トレース用クラス
///////////////////////////////////////////////////////*/
import flash.display.*;
import flash.text.TextField;
import flash.display.Sprite;
class TraceSet extends TextField{
public function TraceSet(){
this.selectable = false;
this.textColor = 0x666666;
trace("started");
}
public function trace(t:String):void{
this.text = t;
}
}