## Posted By

daisuke103 on 02/11/08

# AS2 ãƒžã‚¦ã‚¹ã«ã‚ˆã£ã¦ä½ç½®ãŒå¤‰ã‚ã‚‹æ“¬ä¼¼3Då›žè»¢

/ Published in: Other

`/*author page::http://www.trick7.com/blog/2006/07/05-160520.phpãƒžã‚¦ã‚¹ã®ä½ç½®ã«ã‚ˆã£ã¦å›žè»¢ãƒªãƒ³ã‚±ãƒ¼ã‚¸å: rect ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’ç”¨æ„xmlã‚’ä½¿ã†æ™‚ã¯rectNum = xmlObject.length;ã¨ã—ã¦init()ã‚’xmlãƒ­ãƒ¼ãƒ‰å¾Œã«å®Ÿè¡Œ*/  //--- â†“src ---  import flash.geom.ColorTransform; //Vanishing Pointï¼ˆæ¶ˆå¤±ç‚¹ï¼‰var vpX = Stage.width/2;var vpY = Stage.height/2;//çŸ©å½¢ã®æ•°var rectNum:Number = 20;//ä¸­å¿ƒè»¸ã¨é…ç½®ã™ã‚‹ãƒ ãƒ¼ãƒ“ãƒ¼ã‚¯ãƒªãƒƒãƒ—ã¨ã®è·é›¢var radius:Number = 150;//Focal Lengthï¼ˆç„¦ç‚¹è·é›¢ï¼‰var fl:Number = 250; init();function init():Void {    for (var i:Number = 0; i<rectNum; i++) {        var rect:MovieClip = attachMovie("rect", "rect"+i, i);        var angleInitY:Number = (360/rectNum)*i;        //ãƒ©ã‚¸ã‚¢ãƒ³ã«å¤‰æ›        angleInitY = angleInitY*Math.PI/180;        var cosInitY:Number = Math.cos(angleInitY);        var sinInitY:Number = Math.sin(angleInitY);        var initX1:Number = radius*cosInitY-0*sinInitY;        var initZ1:Number = 0*cosInitY+radius*sinInitY;        rect.x = initX1;        rect.y = 0;        rect.z = initZ1;        rect.number.text=i        //pall.swapDepths(0)//ä¸­å¿ƒæ£’ã‚’é€šã™    }}function onEnterFrame():Void {    if(_root._xmouse>=0&&_root._xmouse<=Stage.width){//ãƒ–ãƒ©ã‚¦ã‚¶ã®åˆ¥ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒé–‹ã‹ã‚ŒãŸæ™‚ã®å¯¾ç­–        for (var i:Number = 0; i<rectNum; i++) {            var rect:MovieClip = this["rect"+i];            var angleY:Number = (_xmouse-vpX)*0.001;            var cosY:Number = Math.cos(angleY);            var sinY:Number = Math.sin(angleY);            var angleX:Number = (_ymouse-vpY)*0.001;            var cosX:Number = Math.cos(angleX);            var sinX:Number = Math.sin(angleX);             var x1:Number = rect.x*cosY-rect.z*sinY;            var z1:Number = rect.z*cosY+rect.x*sinY;            var y1:Number = rect.y*cosX-z1*sinX;            var z2:Number = z1*cosX+rect.y*sinX;             rect.x = x1;            rect.y = y1;            rect.z = z2;            var scale = fl/(fl+rect.z);            rect._xscale = rect._yscale=scale*100;            rect._x = vpX+(rect.x*scale);            rect._y = vpY+(rect.y*scale);            //zã®å€¤ã‚’ã‚‚ã¨ã«ã€é‡ãªã‚Šé †ã‚’èª¿æ•´            rect.swapDepths(-rect.z);            //å¥¥ã®ãƒ ãƒ¼ãƒ“ãƒ¼ã‚¯ãƒªãƒƒãƒ—ã®æ˜Žåº¦ã‚’ä¸‹ã’ã‚‹            var val = Math.min(-5*Math.sqrt(z2),0);            rect.transform.colorTransform = new ColorTransform(1, 1, 1, 1, val, val, val, 0);        }    }}`