Peep Hole
just move your mouse :)
♥0 |
Line 58 |
Modified 2010-09-15 22:21:29 |
MIT License
archived:2017-03-20 03:27:13
ActionScript3 source code
/**
* Copyright Caiim. ( http://wonderfl.net/user/Caiim. )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5pLl
*/
package
{
import flash.text.TextFormatAlign;
import flash.display.BlendMode;
import flash.text.TextFormat;
import flash.text.TextField;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Graphics;
import flash.events.Event;
[SWF(width=500,height=500,frameRate=30)]
public class Shrink extends Sprite
{
private var sw:int = stage.stageWidth;
private var sh:int = stage.stageHeight;
private var num:int = 25;
private var size:int = sw/num;
public function Shrink()
{
var url:URLRequest = new URLRequest("http://www.tobaphotographerclub.com/data/media/7/Monas_Mancur_Oke.jpg");
var load:Loader = new Loader();
load.contentLoaderInfo.addEventListener(Event.COMPLETE, ok);
load.load(url);
addChild(load);
var txt:TextField = new TextField();
txt.text = "MONAS";
txt.setTextFormat(new TextFormat(null, 50, null,null,null, null,null, null, TextFormatAlign.RIGHT));
txt.width = sw;
txt.selectable = false;
addChild(txt);
}
private function ok(e:Event):void
{
for(var i:int = 0;i<num;i++)
for(var j:int = 0;j<num;j++)
{
var _mc:MovieClip = new MovieClip();
_mc.x = size/2+i*size;
_mc.y = size/2+j*size;
_mc.addEventListener(Event.ENTER_FRAME, shrinking);
addChild(_mc);
}
}
// shrinks the movie clip
private function shrinking(e:Event):void
{
var _mc:MovieClip = MovieClip(e.target);
var g:Graphics = _mc.graphics;
var dist:int = Math.sqrt(Math.pow(_mc.x - mouseX,2) + Math.pow(_mc.y - mouseY,2));
g.clear();
g.beginFill(0x000000, 0.89);
var drawSize:int = dist/size;
g.drawCircle(0,0,drawSize);
g.endFill();
}
}
}