※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


FORKED

ニコニコテレビちゃんを描いてみた ニコニコテレビちゃんを動かしてみた [diff(136)]

  1. // forked from uniq's ニコニコテレビちゃんを描いてみた
  2. // ニコニコテレビちゃんを動かしてみた
  3. package{
  4. import flash.display.Sprite;
  5. import flash.utils.*;
  6. public class DrawNicotvchan1 extends Sprite {
  7.     public function DrawNicotvchan1() {
  8.         y = 100;
  9.         var bodies:Array = [];
  10.         for(var i:int = 0; i < 10; i++){
  11.             var body:Body = new Body(i);
  12.             body.scaleX = body.scaleY = Math.pow(0.9, i - 1);
  13.             body.y = -i * Math.pow(0.9, i - 1) * 10;
  14.             addChildAt(body, 0);
  15.             bodies.push(body);
  16.         }
  17.         addEventListener("enterFrame"function(event:*):void{
  18.             for(i = 0; i < bodies.length; i++){
  19.                 body = bodies[i];
  20.                 body.x = (body.x * (i * 2 + 1) + stage.mouseX) / (i * 2 + 2);
  21.             }
  22.         });
  23.     }
  24. }
  25. }
  26. import flash.display.Sprite;
  27. import flash.filters.GlowFilter;
  28. class Body extends Sprite{
  29.     public function Body(num:int){
  30.         var color:uint = 0x000000 + 0x111111 * num;
  31.         var l1:Leg = new Leg();
  32.         l1.x = -30; l1.y = 150
  33.         addChild(l1);
  34.         var l2:Leg = new Leg();
  35.         l2.x = 30; l2.y = 150
  36.         addChild(l2);
  37.         // アンテナを描く
  38.         var antena:Sprite = new Sprite();
  39.         antena.graphics.lineStyle(4, color);
  40.         antena.graphics.moveTo(-3040);
  41.         antena.graphics.lineTo(  060);
  42.         antena.graphics.lineTo( 3040);
  43.         antena.filters = [new GlowFilter(0xffffff)];
  44.         addChild(antena);
  45.   
  46.         // 外側四角を描く
  47.         var s2:Sprite = new Sprite();
  48.         s2.graphics.lineStyle(6, color);
  49.         s2.graphics.beginFill(0xffffff);
  50.         s2.graphics.drawRect(-60012090);
  51.         s2.graphics.endFill();
  52.         s2.y = 60;
  53.         addChild(s2);
  54.   
  55.         // 内側四角を描く
  56.         var s3:Sprite = new Sprite();
  57.         s3.graphics.lineStyle(4, color);
  58.         s3.graphics.beginFill(0xffffff);
  59.         s3.graphics.drawRect(-50010070);
  60.         s3.graphics.endFill();
  61.         s3.y = 70;
  62.         addChild(s3);
  63.   
  64.         // 左目を描く
  65.         var eye1:Sprite = new Sprite();
  66.         eye1.graphics.beginFill(color);
  67.         eye1.graphics.drawCircle(005);
  68.         eye1.x = -30;
  69.         eye1.y = 100;
  70.         addChild(eye1);
  71.   
  72.         // 右目を描く
  73.         var eye2:Sprite = new Sprite();
  74.         eye2.graphics.beginFill(color);
  75.         eye2.graphics.drawCircle(005);
  76.         eye2.x = 30;
  77.         eye2.y = 90;
  78.         addChild(eye2);
  79.   
  80.         // 口を描く
  81.         var s8:Sprite = new Sprite();
  82.         s8.graphics.lineStyle(1, color);
  83.         s8.graphics.beginFill(color);
  84.         s8.graphics.moveTo(  0120);
  85.         s8.graphics.lineTo(-10130);
  86.         s8.graphics.lineTo( 15130);
  87.         s8.graphics.endFill();
  88.         addChild(s8);
  89.         var count:int = num * 2;
  90.         addEventListener("enterFrame"function(event:*):void{
  91.             l1.rotation = 15 * Math.cos(count / 10 * Math.PI);
  92.             l2.rotation = -l1.rotation;
  93.             antena.scaleX = Math.cos(count / 30 * Math.PI);
  94.             eye1.y = 95 + Math.cos(count / 30 * Math.PI) * 5;
  95.             eye2.y = 95 - Math.cos(count / 30 * Math.PI) * 5;
  96.             count = (count + 1) % 360;
  97.         });
  98.     }
  99. }
  100. class Leg extends Sprite{
  101.     public function Leg(){
  102.         graphics.lineStyle(4, 0x000000);
  103.         graphics.beginFill(0xffffff);
  104.         graphics.moveTo( 20, -12);
  105.         graphics.lineTo(  0,  12);
  106.         graphics.lineTo(-20, -12);
  107.         graphics.endFill();
  108.     }
  109. }
noswf
Get Adobe Flash Player