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

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

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


forked from : uniq's ニコニコテレビちゃんを描いてみた [diff(136)]

FORKED

ニコニコテレビちゃんを動かしてみた forked from: ニコニコテレビちゃんを動かしてみた [diff(2)]

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

ニコニコテレビちゃんを動かしてみた forked from: ニコニコテレビちゃんを動かしてみた [diff(1)]

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

ニコニコテレビちゃんを動かしてみた ニコニコテレビちゃんを群がらせてみた [diff(104)]

  1. // forked from nitoyon's ニコニコテレビちゃんを動かしてみた
  2. // forked from uniq's ニコニコテレビちゃんを描いてみた
  3. // see http://www.vergenet.net/~conrad/boids/pseudocode.html
  4. package{
  5. import flash.display.Sprite;
  6. import flash.utils.*;
  7. public class NicoBoids extends Sprite {
  8.     public function NicoBoids() {
  9.         var boids:Array = [];
  10.         for(var i:int = 0; i < 30; i++){
  11.             var body:Body = new Body(0);
  12.             var bodyWrapper:Sprite = new Sprite();
  13.             bodyWrapper.addChild(body);
  14.             body.y = -80;
  15.             bodyWrapper.scaleX = bodyWrapper.scaleY = 0.3;
  16.             addChildAt(bodyWrapper, 0);
  17.             var boid:Boid = new Boid(bodyWrapper, boids);
  18.             boids.push(boid);
  19.         }
  20.         addEventListener("enterFrame"function(event:*):void{
  21.             for(i = 0; i < boids.length; i++){
  22.                 boid = boids[i];
  23.                 boid.update(stage.mouseX, stage.mouseY);
  24.             }
  25.         });
  26.     }
  27. }
  28. }
  29. import flash.display.Sprite;
  30. import flash.filters.GlowFilter;
  31. import flash.geom.Vector3D;
  32. class Boid {
  33.     public function Boid(sprite:Sprite, boids:Array) {
  34.         this.sprite = sprite;
  35.         this.boids = boids;
  36.         // initialize position
  37.         position = new Vector3D(
  38.             Math.random() * 100,
  39.             Math.random() * 100,
  40.             0);
  41.         // initialize velocity
  42.         velocity = new Vector3D(000);
  43.         // flocking parameter
  44.         minDist = 10;
  45.         minDistSq = minDist * minDist;
  46.         maxVelocity = 10;
  47.     }
  48.     public function update(mouseX:Number, mouseY:Number):void {
  49.         var cohesion:Vector3D = getCohesion();
  50.         var separation:Vector3D = getSeparation();
  51.         var alignment:Vector3D = getAlignment();
  52.         var targetting:Vector3D = getTargetting(new Vector3D(mouseX, mouseY, 0));
  53.         velocity = velocity.add(cohesion)
  54.             .add(separation)
  55.             .add(alignment)
  56.             .add(targetting);
  57.         if (velocity.lengthSquared > maxVelocity * maxVelocity) {
  58.             velocity.scaleBy(maxVelocity / velocity.length);
  59.         }
  60.         position = position.add(velocity);
  61.         sprite.x = position.x;
  62.         sprite.y = position.y;
  63.         //sprite.rotation = Math.atan2(velocity.y, velocity.x) * 180 / Math.PI + 90;
  64.     }
  65.     // Boids try to fly towards the centre of mass of neighbouring boids. 
  66.     protected function getCohesion():Vector3D {
  67.         var pc:Vector3D = new Vector3D();
  68.         for (var i:uint = 0; i < boids.length; i++) {
  69.             if (this == boids[i]) { continue; }
  70.             pc = pc.add(boids[i].position);
  71.         }
  72.         pc.scaleBy(1.0 / (boids.length - 1));
  73.         pc = pc.subtract(position);
  74.         pc.scaleBy(0.01);
  75.         return pc;
  76.     }
  77.     // Boids try to keep a small distance away from other objects (including other boids). 
  78.     protected function getSeparation():Vector3D {
  79.         var c:Vector3D = new Vector3D();
  80.         for (var i:uint = 0; i < boids.length; i++) {
  81.             if (this == boids[i]) { continue; }
  82.             var dist:Vector3D = boids[i].position.subtract(position);
  83.             if (dist.lengthSquared >= minDistSq) { continue; }
  84.             c = c.subtract(dist);
  85.         }
  86.         return c;
  87.     }
  88.     // Boids try to match velocity with near boids.
  89.     protected function getAlignment():Vector3D {
  90.         var pv:Vector3D = new Vector3D();
  91.         for (var i:uint = 0; i < boids.length; i++) {
  92.             if (this == boids[i]) { continue; }
  93.             pv = pv.add(boids[i].velocity);
  94.         }
  95.         pv.scaleBy(1.0 / (boids.length - 1));
  96.         pv = pv.subtract(velocity);
  97.         pv.scaleBy(1.0 / 8);
  98.         return pv;
  99.     }
  100.     // Tendency towards a particular place
  101.     protected function getTargetting(target:Vector3D):Vector3D {
  102.         target = target.subtract(position);
  103.         target.scaleBy(1.0 / 100);
  104.         return target;
  105.     }
  106.     public var sprite:Sprite;
  107.     public var velocity:Vector3D;
  108.     public var position:Vector3D;
  109.     public var minDist:Number;
  110.     public var minDistSq:Number;
  111.     public var maxVelocity:Number;
  112.     public var boids:Array;
  113. }
  114. class Body extends Sprite{
  115.     public function Body(num:int){
  116.         var color:uint = 0x000000 + 0x111111 * num;
  117.         var l1:Leg = new Leg();
  118.         l1.x = -30; l1.y = 150
  119.         addChild(l1);
  120.         var l2:Leg = new Leg();
  121.         l2.x = 30; l2.y = 150
  122.         addChild(l2);
  123.         // アンテナを描く
  124.         var antena:Sprite = new Sprite();
  125.         antena.graphics.lineStyle(4, color);
  126.         antena.graphics.moveTo(-3040);
  127.         antena.graphics.lineTo(  060);
  128.         antena.graphics.lineTo( 3040);
  129.         antena.filters = [new GlowFilter(0xffffff)];
  130.         addChild(antena);
  131.   
  132.         // 外側四角を描く
  133.         var s2:Sprite = new Sprite();
  134.         s2.graphics.lineStyle(6, color);
  135.         s2.graphics.beginFill(0xffffff);
  136.         s2.graphics.drawRect(-60012090);
  137.         s2.graphics.endFill();
  138.         s2.y = 60;
  139.         addChild(s2);
  140.   
  141.         // 内側四角を描く
  142.         var s3:Sprite = new Sprite();
  143.         s3.graphics.lineStyle(4, color);
  144.         s3.graphics.beginFill(0xffffff);
  145.         s3.graphics.drawRect(-50010070);
  146.         s3.graphics.endFill();
  147.         s3.y = 70;
  148.         addChild(s3);
  149.   
  150.         // 左目を描く
  151.         var eye1:Sprite = new Sprite();
  152.         eye1.graphics.beginFill(color);
  153.         eye1.graphics.drawCircle(005);
  154.         eye1.x = -30;
  155.         eye1.y = 100;
  156.         addChild(eye1);
  157.   
  158.         // 右目を描く
  159.         var eye2:Sprite = new Sprite();
  160.         eye2.graphics.beginFill(color);
  161.         eye2.graphics.drawCircle(005);
  162.         eye2.x = 30;
  163.         eye2.y = 90;
  164.         addChild(eye2);
  165.   
  166.         // 口を描く
  167.         var s8:Sprite = new Sprite();
  168.         s8.graphics.lineStyle(1, color);
  169.         s8.graphics.beginFill(color);
  170.         s8.graphics.moveTo(  0120);
  171.         s8.graphics.lineTo(-10130);
  172.         s8.graphics.lineTo( 15130);
  173.         s8.graphics.endFill();
  174.         addChild(s8);
  175.         var count:int = num * 2;
  176.         addEventListener("enterFrame"function(event:*):void{
  177.             l1.rotation = 15 * Math.cos(count / 10 * Math.PI);
  178.             l2.rotation = -l1.rotation;
  179.             antena.scaleX = Math.cos(count / 30 * Math.PI);
  180.             eye1.y = 95 + Math.cos(count / 30 * Math.PI) * 5;
  181.             eye2.y = 95 - Math.cos(count / 30 * Math.PI) * 5;
  182.             count = (count + 1) % 360;
  183.         });
  184.     }
  185. }
  186. class Leg extends Sprite{
  187.     public function Leg(){
  188.         graphics.lineStyle(4, 0x000000);
  189.         graphics.beginFill(0xffffff);
  190.         graphics.moveTo( 20, -12);
  191.         graphics.lineTo(  0,  12);
  192.         graphics.lineTo(-20, -12);
  193.         graphics.endFill();
  194.     }
  195. }
noswf
Get Adobe Flash Player