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

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

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


forked from : nitoyon's Perfect Shuffle Visualization [diff(73)]

FAVORITE BY
:
:
:
おお!
:
すげー!
:
おぉ、あの投稿はここにつながるのか。つながった!
FORKED

Perfect Shuffle Visualization 2 Perfect Shuffle Visualization 3 [diff(45)]

  1. // forked from nitoyon's Perfect Shuffle Visualization 2
  2. //------------------------------------------------------
  3. // Perfect Shuffle Visualization
  4. //------------------------------------------------------
  5. // combination of:
  6. // - Perfect Shuffle Visualization
  7. //   http://wonderfl.net/code/bb7b5c2bfec888803f118cd47e3f727b00772b62
  8. // - Square to Donut
  9. //   http://wonderfl.net/code/b2dbbb5b857c6ebd8ed4460e83338f3e5ce4abe8
  10. //------------------------------------------------------
  11. // How many times does it requires for 15 cards to 
  12. // go back to where one started?
  13. //
  14. // inspired by:
  15. // http://d.hatena.ne.jp/nishiohirokazu/20100107/1262835414
  16. package {
  17. import flash.display.*;
  18. import flash.events.Event;
  19. import flash.geom.Point;
  20. import flash.filters.BlurFilter;
  21. import org.libspark.betweenas3.BetweenAS3;
  22. import org.libspark.betweenas3.tweens.ITween;
  23. import org.libspark.betweenas3.easing.*;
  24. import frocessing.color.ColorHSV;
  25. [SWF(backgroundColor="0x000000")]
  26. public class PerfectShuffleVisualization3 extends Sprite {
  27.     public var r:Number = 6400;
  28.     public var d:Number = 300;
  29.     public var angle:Number = 3;
  30.     private var canvas:Sprite = new Sprite();
  31.     private const NUM:int = 5;
  32.     private const SIZE:int = 30;
  33.     private const POINT_PER_LINE:Number = 10;
  34.     private const CANVAS_SIZE:Number = 475;
  35.     public function PerfectShuffleVisualization3() {
  36.         stage.scaleMode = "noScale";
  37.         stage.align = "TL";
  38.         // draw background
  39.         graphics.beginFill(0x000000);
  40.         graphics.drawRect(00, CANVAS_SIZE, CANVAS_SIZE);
  41.         graphics.endFill(); 
  42.         addChild(canvas);
  43.         canvas.x = CANVAS_SIZE / 2;
  44.         canvas.y = CANVAS_SIZE / 2 + d / 2;
  45.         canvas.filters = [new BlurFilter(33)];
  46.         draw();
  47.         var tween:ITween = BetweenAS3.parallel(
  48.             BetweenAS3.tween(this, { r: 30 }, null5, Quint.easeOut),
  49.             BetweenAS3.tween(this, { d: 160 }, null5, Cubic.easeOut),
  50.             BetweenAS3.tween(this, { angle: 360 }, null5, Sine.easeIn),
  51.             BetweenAS3.tween(canvas, { y: CANVAS_SIZE / 2 }, null5)
  52.         );
  53.         tween.onUpdate = draw;
  54.         stage.addEventListener("click"function(event:Event):void { tween.gotoAndPlay(0); });
  55.         tween.play();
  56.     }
  57.     private function draw():void {
  58.         var p:Point = new Point();
  59.         var g:Graphics = canvas.graphics;
  60.         g.clear();
  61.         // draw lines
  62.         for (var yy:int = 0; yy < SIZE; yy++) {
  63.             var num:int = yy, prev_num:Number = yy;
  64.             g.lineStyle(3new ColorHSV(yy * 270 / SIZE, .7).value, .7);
  65.             p.x = 0; p.y = num; getXY(p);
  66.             g.moveTo(p.x, p.y);
  67.             for (var xx:int = 0; xx < NUM; xx++) {
  68.                 num = getNext(num);
  69.                 for (var i:int = 0; i < POINT_PER_LINE; i++) {
  70.                     var ratio:Number = (i + 1.0) / POINT_PER_LINE;
  71.                     p.x = xx + ratio;
  72.                     p.y = prev_num * (1 - ratio) + num * ratio;
  73.                     getXY(p);
  74.                     g.lineTo(p.x, p.y);
  75.                 }
  76.                 prev_num = num;
  77.             }
  78.         }
  79.     }
  80.     // get next position after perfect shuffle
  81.     private function getNext(num:int):int {
  82.         if (num < SIZE / 2) {
  83.             return num * 2 + 1;
  84.         } else {
  85.             return (num - SIZE / 2) * 2;
  86.         }
  87.     }
  88.     private function getXY(pt:Point):Point {
  89.         var rad:Number = (-angle / 2.0 + angle * pt.x / NUM) / 180.0 * Math.PI;
  90.         pt.x =  (r + d / (SIZE - 1) * pt.y) * Math.sin(rad);
  91.         pt.y = -(r + d / (SIZE - 1) * pt.y) * Math.cos(rad) + r * Math.cos(angle / 2 / 180 * Math.PI);
  92.         return pt;
  93.     }
  94. }
  95. }
noswf
  1. // forked from nitoyon's Perfect Shuffle Visualization 2
  2. //------------------------------------------------------
  3. // Perfect Shuffle Visualization
  4. //------------------------------------------------------
  5. // combination of:
  6. // - Perfect Shuffle Visualization
  7. //   http://wonderfl.net/code/bb7b5c2bfec888803f118cd47e3f727b00772b62
  8. // - Square to Donut
  9. //   http://wonderfl.net/code/b2dbbb5b857c6ebd8ed4460e83338f3e5ce4abe8
  10. //------------------------------------------------------
  11. // How many times does it requires for 15 cards to 
  12. // go back to where one started?
  13. //
  14. // inspired by:
  15. // http://d.hatena.ne.jp/nishiohirokazu/20100107/1262835414
  16. package {
  17. import flash.display.*;
  18. import flash.events.Event;
  19. import flash.geom.Point;
  20. import flash.filters.BlurFilter;
  21. import org.libspark.betweenas3.BetweenAS3;
  22. import org.libspark.betweenas3.tweens.ITween;
  23. import org.libspark.betweenas3.easing.*;
  24. import frocessing.color.ColorHSV;
  25. [SWF(backgroundColor="0x000000")]
  26. public class Beginner extends Sprite {
  27.     public var r:Number = 800;
  28.     public var d:Number = 80;
  29.     public var angle:Number = 6;
  30.     private const NUM:int = 5;
  31.     private const SIZE:int = 30;
  32.     private var msk:Sprite;
  33.     
  34.     public function Beginner() {
  35.         stage.scaleMode = "noScale";
  36.         stage.align = "TL";
  37.         x = 240; y = 240;
  38.         draw();
  39.         var tween:ITween = BetweenAS3.delay(BetweenAS3.parallel(
  40.             BetweenAS3.tween(this, { r: 30 }, null5, Quint.easeOut),
  41.             BetweenAS3.tween(this, { angle: 360, d: 160 }, null5)
  42.         ), .5);
  43.         tween.onUpdate = draw;
  44.         tween.play();
  45.         stage.addEventListener("click"function(event):void { tween.play() });
  46.         filters = [new BlurFilter(22)];
  47.     }
  48.     private function draw():void {
  49.         var p:Point = new Point();
  50.         var g:Graphics = graphics;
  51.         g.clear();
  52.         // draw background
  53.         g.beginFill(0x000000);
  54.         g.drawRect(-475, -475900900);
  55.         g.endFill();
  56.         // draw lines
  57.         for (var yy:int = 0; yy < SIZE; yy++) {
  58.             var num:int = yy;
  59.             g.lineStyle(2new ColorHSV(yy * 270 / SIZE, .7).value, .7);
  60.             p.x = 0; p.y = num; getXY(p);
  61.             g.moveTo(p.x, p.y);
  62.             for (var xx:int = 1; xx <= NUM; xx++) {
  63.                 num = getNext(num);
  64.                 p.x = xx; p.y = num; getXY(p);
  65.                 g.lineTo(p.x, p.y);
  66.             }
  67.         }
  68.     }
  69.     // get next position after perfect shuffle
  70.     private function getNext(num:int):int {
  71.         if (num < SIZE / 2) {
  72.             return num * 2 + 1;
  73.         } else {
  74.             return (num - SIZE / 2) * 2;
  75.         }
  76.     }
  77.     private function getXY(pt:Point):Point {
  78.         var rad:Number = (-angle / 2.0 + angle * pt.x / NUM) / 180.0 * Math.PI;
  79.         pt.x =  (r + d / (SIZE - 1) * pt.y) * Math.sin(rad);
  80.         pt.y = -(r + d / (SIZE - 1) * pt.y) * Math.cos(rad) + r * Math.cos(angle / 2 / 180 * Math.PI);
  81.         return pt;
  82.     }
  83. }
  84. }
noswf
  1. // forked from nitoyon's Perfect Shuffle Visualization 2
  2. //------------------------------------------------------
  3. // Perfect Shuffle Visualization
  4. //------------------------------------------------------
  5. // combination of:
  6. // - Perfect Shuffle Visualization
  7. //   http://wonderfl.net/code/bb7b5c2bfec888803f118cd47e3f727b00772b62
  8. // - Square to Donut
  9. //   http://wonderfl.net/code/b2dbbb5b857c6ebd8ed4460e83338f3e5ce4abe8
  10. //------------------------------------------------------
  11. // How many times does it requires for 15 cards to 
  12. // go back to where one started?
  13. //
  14. // inspired by:
  15. // http://d.hatena.ne.jp/nishiohirokazu/20100107/1262835414
  16. package {
  17. import flash.display.*;
  18. import flash.events.Event;
  19. import flash.geom.Point;
  20. import flash.filters.BlurFilter;
  21. import org.libspark.betweenas3.BetweenAS3;
  22. import org.libspark.betweenas3.tweens.ITween;
  23. import org.libspark.betweenas3.easing.*;
  24. import frocessing.color.ColorHSV;
  25. [SWF(backgroundColor="0x000000")]
  26. public class Beginner extends Sprite {
  27.     public var r:Number = 800;
  28.     public var d:Number = 80;
  29.     public var angle:Number = 6;
  30.     private const NUM:int = 5;
  31.     private const SIZE:int = 30;
  32.     private var msk:Sprite;
  33.     
  34.     public function Beginner() {
  35.         stage.scaleMode = "noScale";
  36.         stage.align = "TL";
  37.         x = 240; y = 240;
  38.         draw();
  39.         var tween:ITween = BetweenAS3.delay(BetweenAS3.parallel(
  40.             BetweenAS3.tween(this, { r: 30 }, null5, Quint.easeOut),
  41.             BetweenAS3.tween(this, { angle: 360, d: 160 }, null5)
  42.         ), .5);
  43.         tween.onUpdate = draw;
  44.         tween.play();
  45.         stage.addEventListener("click"function(event):void { tween.play() });
  46.         filters = [new BlurFilter(22)];
  47.     }
  48.     private function draw():void {
  49.         var p:Point = new Point();
  50.         var g:Graphics = graphics;
  51.         g.clear();
  52.         // draw background
  53.         g.beginFill(0x000000);
  54.         g.drawRect(-475, -475900900);
  55.         g.endFill();
  56.         // draw lines
  57.         for (var yy:int = 0; yy < SIZE; yy++) {
  58.             var num:int = yy;
  59.             g.lineStyle(2new ColorHSV(yy * 270 / SIZE, .7).value, .7);
  60.             p.x = 0; p.y = num; getXY(p);
  61.             g.moveTo(p.x, p.y);
  62.             for (var xx:int = 1; xx <= NUM; xx++) {
  63.                 num = getNext(num);
  64.                 p.x = xx; p.y = num; getXY(p);
  65.                 g.lineTo(p.x, p.y);
  66.             }
  67.         }
  68.     }
  69.     // get next position after perfect shuffle
  70.     private function getNext(num:int):int {
  71.         if (num < SIZE / 2) {
  72.             return num * 2 + 1;
  73.         } else {
  74.             return (num - SIZE / 2) * 2;
  75.         }
  76.     }
  77.     private function getXY(pt:Point):Point {
  78.         var rad:Number = (-angle / 2.0 + angle * pt.x / NUM) / 180.0 * Math.PI;
  79.         pt.x =  (r + d / (SIZE - 1) * pt.y) * Math.sin(rad);
  80.         pt.y = -(r + d / (SIZE - 1) * pt.y) * Math.cos(rad) + r * Math.cos(angle / 2 / 180 * Math.PI);
  81.         return pt;
  82.     }
  83. }
  84. }
noswf
  1. // forked from nitoyon's Perfect Shuffle Visualization 2
  2. //------------------------------------------------------
  3. // Perfect Shuffle Visualization
  4. //------------------------------------------------------
  5. // combination of:
  6. // - Perfect Shuffle Visualization
  7. //   http://wonderfl.net/code/bb7b5c2bfec888803f118cd47e3f727b00772b62
  8. // - Square to Donut
  9. //   http://wonderfl.net/code/b2dbbb5b857c6ebd8ed4460e83338f3e5ce4abe8
  10. //------------------------------------------------------
  11. // How many times does it requires for 15 cards to 
  12. // go back to where one started?
  13. //
  14. // inspired by:
  15. // http://d.hatena.ne.jp/nishiohirokazu/20100107/1262835414
  16. package {
  17. import flash.display.*;
  18. import flash.events.Event;
  19. import flash.geom.Point;
  20. import flash.filters.BlurFilter;
  21. import org.libspark.betweenas3.BetweenAS3;
  22. import org.libspark.betweenas3.tweens.ITween;
  23. import org.libspark.betweenas3.easing.*;
  24. import frocessing.color.ColorHSV;
  25. [SWF(backgroundColor="0x000000")]
  26. public class Beginner extends Sprite {
  27.     public var r:Number = 800;
  28.     public var d:Number = 80;
  29.     public var angle:Number = 6;
  30.     private const NUM:int = 5;
  31.     private const SIZE:int = 30;
  32.     private var msk:Sprite;
  33.     
  34.     public function Beginner() {
  35.         stage.scaleMode = "noScale";
  36.         stage.align = "TL";
  37.         x = 240; y = 240;
  38.         draw();
  39.         var tween:ITween = BetweenAS3.delay(BetweenAS3.parallel(
  40.             BetweenAS3.tween(this, { r: 30 }, null5, Quint.easeOut),
  41.             BetweenAS3.tween(this, { angle: 360, d: 160 }, null5)
  42.         ), .5);
  43.         tween.onUpdate = draw;
  44.         tween.play();
  45.         stage.addEventListener("click"function(event):void { tween.play() });
  46.         filters = [new BlurFilter(22)];
  47.     }
  48.     private function draw():void {
  49.         var p:Point = new Point();
  50.         var g:Graphics = graphics;
  51.         g.clear();
  52.         // draw background
  53.         g.beginFill(0x000000);
  54.         g.drawRect(-475, -475900900);
  55.         g.endFill();
  56.         // draw lines
  57.         for (var yy:int = 0; yy < SIZE; yy++) {
  58.             var num:int = yy;
  59.             g.lineStyle(2new ColorHSV(yy * 270 / SIZE, .7).value, .7);
  60.             p.x = 0; p.y = num; getXY(p);
  61.             g.moveTo(p.x, p.y);
  62.             for (var xx:int = 1; xx <= NUM; xx++) {
  63.                 num = getNext(num);
  64.                 p.x = xx; p.y = num; getXY(p);
  65.                 g.lineTo(p.x, p.y);
  66.             }
  67.         }
  68.     }
  69.     // get next position after perfect shuffle
  70.     private function getNext(num:int):int {
  71.         if (num < SIZE / 2) {
  72.             return num * 2 + 1;
  73.         } else {
  74.             return (num - SIZE / 2) * 2;
  75.         }
  76.     }
  77.     private function getXY(pt:Point):Point {
  78.         var rad:Number = (-angle / 2.0 + angle * pt.x / NUM) / 180.0 * Math.PI;
  79.         pt.x =  (r + d / (SIZE - 1) * pt.y) * Math.sin(rad);
  80.         pt.y = -(r + d / (SIZE - 1) * pt.y) * Math.cos(rad) + r * Math.cos(angle / 2 / 180 * Math.PI);
  81.         return pt;
  82.     }
  83. }
  84. }
noswf
Get Adobe Flash Player