éªã®ã¢ãã¡ã¼ã·ã§ã³
ããã¾ãFlashã®åºæ¬(?)ã®éªãéãã¢ãã¡ã¼ã·ã§ã³ã®ä½ãæ¹ã§ã
解説ã¯ã¤ã¥ããã
æ°è¦ãã¡ã¤ã«ä½æ
ã¹ãã¼ã¸è¨å®ã¯ãµã¤ãºã400Ã300ãèæ¯è²ãé»ããã¬ã¼ã ã¬ã¼ãã¯30ã«
ã¾ãã¯èæ¯ãè¨ç½®
æ°è¦ã·ã³ãã«ä½æããActionScriptã«æ¸ãåºãã«ãã§ãã¯ãå
¥ãã¦ãã¯ã©ã¹åãSnowã«
è²:ç½ãç·ãªããã§5Ã5ã®åãæã
ãããããã«ã ã¼ãã¼ã¯ãªããã·ã³ãã«ã«å¤æãããã£ã«ã¿:ã¼ãããæ°´å¹³ãåç´3ã«
ã·ã¼ã³1ã«æ»ããæ°è¦ã¬ã¤ã¤ã¼ã追å ãActionScriptãè¨è¿°
//éªã®æ° var num:int = 200; //éªããããé å var sList:Array = []; for (var i:int = 0; i<num; i++) { //éªãä½æ var snow:Snow = new Snow(); //éªã®åæä½ç½® snow.x = Math.random()*stage.stageWidth; snow.y = Math.random()*stage.stageHeight; //éªã®å¤§ãããçæé ã«å°ãããã¦ãã snow.scaleX = snow.scaleY = 1/(0.02*i+1); //å¾æãã¤ãã¦å½¢ãã©ã³ãã ã« var mtx:Matrix = snow.transform.matrix; mtx.c = Math.random()-0.5; mtx.b = Math.random()-0.5; snow.transform.matrix = mtx; //éªãé ç½®ãã¦é åã«ããã addChildAt(snow, 1); sList.push(snow); //ããããã®Xæ¹åã®é度è¨å® sList[i].vx = Math.random()-0.5; } //éªã®åãã®ã¤ãã³ã addEventListener(Event.ENTER_FRAME,parallax); function parallax(e:Event):void { for (i=0; i<num; i++) { //Xæ¹åã¨Yæ¹åã®åãè¨å®(奥ã®ãã®ã»ã©é ããªã) sList[i].x += sList[i].vx/(0.02*i+1); sList[i].y += 3/(0.02*i+1); //éªãç»é¢ã®ä¸ã«ã§ããä¸ã«ç§»å if (sList[i].y>300) { sList[i].x = Math.random()*stage.stageWidth; sList[i].y = 0; } } }
ããã§ã ã¼ãã¼ãã¬ãã¥ã¼ããã¨ä»¥ä¸ã®ããã«ãªã£ã¦ããã¨æãã¾ã
以ä¸ãéªã®ã¢ãã¡ã¼ã·ã§ã³ã®ä½ãæ¹ã§ãã