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


embed

FAVORITE BY
:
effectMac transition type
:
effectgreat effect
:
:
ジニー
:
:
:
:
BetweenAS3effectCool effect with BetweenAS3
:
Ginny!!
:
:
OSX のジニーエフェクトとはちょっと違うなー
:
:
:
:
:
:
Aspire image
:
Useful液態抽取效果
:
:
:
不錯的效果真不錯的效果
:
:
:
:
變形把圖吸入場景上的某一點再從此點還原
:
genie effect, bitmapdata distort
:
:
giiny effect
:
thanks! very nice. this may come handy sometime.
:
ハンパネエ
:
かっこよす
:
:
:
goodGinny Effect素敵すぎる
:
:
:
Bitmap
:
いつも思うが画像のセンスがよすぎる
:
ginnyEffectこれがジニー@@!
:
:
:
:
:
nice
:
おぉ,気持ちいい.
:
Mac
:
:
cool
:
:
いいね
:
仕事早い!! でもどちらかというとGInnyよりSuckエフェクトっぽい。
:
かっこいい
:
:
:
MAC
:
:
:
drawTriangleseffectMacで有名らしいジニーエフェクト。アラビアンナイト。
:
BetweenAS3ginnyeffectdrawTrianglesジニーエフェクト
:
:
これは(;´Д`)スバラスィ ...ハァハァ
:
:
!!!
:
FORKED
  1. // forked from clockmaker's Ginny Effect Modoki
  2. /**
  3.  * Ginny Effect Modoki
  4.  * 
  5.  * 作ってしまいました。。。
  6.  * 
  7.  * Inspired by
  8.  * http://fladdict.net/blog/2009/09/flash-ginny-effect.html
  9.  * http://fladdict.net/exp/ginnyeffect/
  10.  * http://twitter.com/fladdict/status/3842965317
  11.  *
  12.  * Photo by 
  13.  * http://www.flickr.com/photos/88403964@N00/2662752839/ (by Yasu)
  14.  *
  15.  * 9/9(Wed) 04:00 first post http://twitter.com/clockmaker/status/3845570478
  16.  * ※ Mac OS X の隠しエフェクトの「Suck」っぽい http://bit.ly/11vMDh
  17.  */
  18. package {
  19.     import flash.display.*;
  20.     import flash.events.*;
  21.     import flash.geom.*;
  22.     import flash.net.*;
  23.     import flash.system.*;
  24.     import org.libspark.betweenas3.BetweenAS3;
  25.     import org.libspark.betweenas3.easing.*;
  26.     import org.libspark.betweenas3.tweens.ITween;
  27.     import com.bit101.components.*;
  28.     
  29.     [SWF(frameRate = 60)]
  30.     public class Main extends Sprite {
  31.         
  32.         private const IMAGE_URL:String = "http://farm4.static.flickr.com/3190/2662752839_249c6642b1.jpg";
  33.         private const IMG_W:int = 500;
  34.         private const IMG_H:int = 375;
  35.         private const SEGMENT:int = 21;
  36.         private var loader:Loader;
  37.         private var vertexs:Array;
  38.         private var sprite:Sprite;
  39.         private var isHide:Boolean = false;
  40.         private var isShift:Boolean = false;
  41.         
  42.         public function Main():void {
  43.             // init
  44.             stage.quality = StageQuality.MEDIUM;
  45.             graphics.beginFill(0x0);
  46.             graphics.drawRect(00465465);
  47.             
  48.             new Label(this360440"PLEASE CLICK STAGE")
  49.             
  50.             // load
  51.             var context:LoaderContext = new LoaderContext(true);
  52.             loader = new Loader();
  53.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE, compHandler);
  54.             loader.load(new URLRequest(IMAGE_URL), context);
  55.         }
  56.         
  57.         private function compHandler(e:Event):void {
  58.             sprite = new Sprite();
  59.             addChild(sprite);
  60.             vertexs = []
  61.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  62.                 vertexs[xx] = [];
  63.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  64.                     vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  65.                 }
  66.             }
  67.             draw();
  68.             addEventListener(Event.ENTER_FRAME, draw);
  69.             stage.addEventListener(MouseEvent.CLICK, clickHandler);
  70.             stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  71.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  72.         }
  73.         
  74.         private function clickHandler(e:MouseEvent):void {
  75.             var tweens:Array = [];
  76.             var xx:int, yy:int, delay:Number;
  77.             var px:Number = SEGMENT * (mouseX / IMG_W);
  78.             var py:Number = SEGMENT * (mouseY / IMG_H);
  79.             
  80.             if (!isHide) {
  81.                 for (xx = 0; xx < SEGMENT; xx++) {
  82.                     for (yy = 0; yy < SEGMENT; yy++) {
  83.                         vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  84.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py)) / 40;
  85.                         
  86.                         tweens.push(
  87.                             BetweenAS3.delay(
  88.                                 BetweenAS3.tween(vertexs[xx][yy], {
  89.                                     x : px * IMG_W / SEGMENT,
  90.                                     y : py * IMG_H / SEGMENT
  91.                                 },null, delay, Cubic.easeIn),
  92.                                 delay / 2
  93.                             )
  94.                         )
  95.                     }
  96.                 }
  97.             }else {
  98.                 // 重み付けが怪しい・・・
  99.                 var max:Number = 0;
  100.                 for (xx = 0; xx < SEGMENT; xx++) {
  101.                     for (yy = 0; yy < SEGMENT; yy++) {
  102.                         vertexs[xx][yy] = new Point(px * IMG_W / SEGMENT, py * IMG_H / SEGMENT);
  103.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))
  104.                         max = Math.max(max, delay);
  105.                     }
  106.                 }
  107.                 for (xx = 0; xx < SEGMENT; xx++) {
  108.                     for (yy = 0; yy < SEGMENT; yy++) {
  109.                         delay = (max - Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))) / 40;
  110.                         tweens.push(
  111.                             BetweenAS3.delay(
  112.                                 BetweenAS3.tween(vertexs[xx][yy], {
  113.                                     x : xx * IMG_W / SEGMENT,
  114.                                     y : yy * IMG_H / SEGMENT
  115.                                 },null, delay + 0.05, Quad.easeOut),
  116.                                 delay / 2
  117.                             )
  118.                         )
  119.                     }
  120.                 }
  121.             }
  122.             
  123.             var itw:ITween = BetweenAS3.parallelTweens(tweens);
  124.             if (isShift) itw = BetweenAS3.scale(itw, 5);
  125.             itw.play();
  126.             
  127.             isHide = !isHide;
  128.         }
  129.         
  130.         /**
  131.          * drawTriangles でテクスチャを貼り付けるメソッド
  132.          * 参考: http://wonderfl.net/code/e7e1e28a9f20d73f11f0bb02d3e4b5f512c7cc0f
  133.          */
  134.         private function draw(e:Event = null):void {
  135.             var vertices:Vector.<Number> = new Vector.<Number>();
  136.             var indices:Vector.<int> = new Vector.<int>();
  137.             var uvtData:Vector.<Number> = new Vector.<Number>();
  138.             
  139.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  140.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  141.                     vertices[vertices.length] = vertexs[xx][yy].x
  142.                     vertices[vertices.length] = vertexs[xx][yy].y
  143.                     uvtData[uvtData.length] = xx / SEGMENT;
  144.                     uvtData[uvtData.length] = yy / SEGMENT;
  145.                 }
  146.             }
  147.             
  148.             for (var i:int = 0; i < SEGMENT - 1; i++) {
  149.                 for (var j:int = 0; j < SEGMENT - 1; j++) {
  150.                     indices.push(i * SEGMENT + j, i * SEGMENT + j + 1, (i + 1) * SEGMENT + j);
  151.                     indices.push(i * SEGMENT + j + 1, (i + 1) * SEGMENT + 1 + j, (i + 1) * SEGMENT + j);
  152.                 }
  153.             }
  154.             
  155.             var g:Graphics = sprite.graphics;
  156.             g.clear();
  157.             g.beginBitmapFill(Bitmap(loader.content).bitmapData);
  158.             g.drawTriangles(vertices, indices, uvtData);
  159.             g.endFill();
  160.         }
  161.         
  162.         /**
  163.          * Shiftキーを押してるとスローモーションになる
  164.          * macの挙動と同じように
  165.          */
  166.         private function keyUpHandler(e:KeyboardEvent):void {
  167.             if(e.keyCode == 16) isShift = false;
  168.         }
  169.         
  170.         private function keyDownHandler(e:KeyboardEvent):void {
  171.             if(e.keyCode == 16) isShift = true;
  172.         }
  173.     }
  174. }
noswf
  1. // forked from clockmaker's Ginny Effect Modoki
  2. /**
  3.  * Ginny Effect Modoki
  4.  * 
  5.  * 作ってしまいました。。。
  6.  * 
  7.  * Inspired by
  8.  * http://fladdict.net/blog/2009/09/flash-ginny-effect.html
  9.  * http://fladdict.net/exp/ginnyeffect/
  10.  * http://twitter.com/fladdict/status/3842965317
  11.  *
  12.  * Photo by 
  13.  * http://www.flickr.com/photos/88403964@N00/2662752839/ (by Yasu)
  14.  *
  15.  * 9/9(Wed) 04:00 first post http://twitter.com/clockmaker/status/3845570478
  16.  * ※ Mac OS X の隠しエフェクトの「Suck」っぽい http://bit.ly/11vMDh
  17.  */
  18. package {
  19.     import flash.display.*;
  20.     import flash.events.*;
  21.     import flash.geom.*;
  22.     import flash.net.*;
  23.     import flash.system.*;
  24.     import org.libspark.betweenas3.BetweenAS3;
  25.     import org.libspark.betweenas3.easing.*;
  26.     import org.libspark.betweenas3.tweens.ITween;
  27.     import com.bit101.components.*;
  28.     
  29.     [SWF(frameRate = 60)]
  30.     public class Main extends Sprite {
  31.         
  32.         private const IMAGE_URL:String = "http://farm4.static.flickr.com/3190/2662752839_249c6642b1.jpg";
  33.         private const IMG_W:int = 500;
  34.         private const IMG_H:int = 375;
  35.         private const SEGMENT:int = 20;
  36.         private var loader:Loader;
  37.         private var vertexs:Array;
  38.         private var sprite:Sprite;
  39.         private var isHide:Boolean = false;
  40.         private var isShift:Boolean = false;
  41.         
  42.         public function Main():void {
  43.             // init
  44.             stage.quality = StageQuality.MEDIUM;
  45.             graphics.beginFill(0x0);
  46.             graphics.drawRect(00465465);
  47.             
  48.             new Label(this360440"PLEASE CLICK STAGE")
  49.             
  50.             // load
  51.             var context:LoaderContext = new LoaderContext(true);
  52.             loader = new Loader();
  53.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE, compHandler);
  54.             loader.load(new URLRequest(IMAGE_URL), context);
  55.         }
  56.         
  57.         private function compHandler(e:Event):void {
  58.             sprite = new Sprite();
  59.             addChild(sprite);
  60.             vertexs = []
  61.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  62.                 vertexs[xx] = [];
  63.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  64.                     vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  65.                 }
  66.             }
  67.             draw();
  68.             addEventListener(Event.ENTER_FRAME, draw);
  69.             stage.addEventListener(MouseEvent.CLICK, clickHandler);
  70.             stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  71.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  72.         }
  73.         
  74.         private function clickHandler(e:MouseEvent):void {
  75.             var tweens:Array = [];
  76.             var xx:int, yy:int, delay:Number;
  77.             var px:Number = SEGMENT * (mouseX / IMG_W);
  78.             var py:Number = SEGMENT * (mouseY / IMG_H);
  79.             
  80.             if (!isHide) {
  81.                 for (xx = 0; xx < SEGMENT; xx++) {
  82.                     for (yy = 0; yy < SEGMENT; yy++) {
  83.                         vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  84.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py)) / 40;
  85.                         
  86.                         tweens.push(
  87.                             BetweenAS3.delay(
  88.                                 BetweenAS3.tween(vertexs[xx][yy], {
  89.                                     x : px * IMG_W / SEGMENT,
  90.                                     y : py * IMG_H / SEGMENT
  91.                                 },null, delay, Cubic.easeIn),
  92.                                 delay / 2
  93.                             )
  94.                         )
  95.                     }
  96.                 }
  97.             }else {
  98.                 // 重み付けが怪しい・・・
  99.                 var max:Number = 0;
  100.                 for (xx = 0; xx < SEGMENT; xx++) {
  101.                     for (yy = 0; yy < SEGMENT; yy++) {
  102.                         vertexs[xx][yy] = new Point(px * IMG_W / SEGMENT, py * IMG_H / SEGMENT);
  103.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))
  104.                         max = Math.max(max, delay);
  105.                     }
  106.                 }
  107.                 for (xx = 0; xx < SEGMENT; xx++) {
  108.                     for (yy = 0; yy < SEGMENT; yy++) {
  109.                         delay = (max - Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))) / 40;
  110.                         tweens.push(
  111.                             BetweenAS3.delay(
  112.                                 BetweenAS3.tween(vertexs[xx][yy], {
  113.                                     x : xx * IMG_W / SEGMENT,
  114.                                     y : yy * IMG_H / SEGMENT
  115.                                 },null, delay + 0.05, Quad.easeOut),
  116.                                 delay / 2
  117.                             )
  118.                         )
  119.                     }
  120.                 }
  121.             }
  122.             
  123.             var itw:ITween = BetweenAS3.parallelTweens(tweens);
  124.             if (isShift) itw = BetweenAS3.scale(itw, 5);
  125.             itw.play();
  126.             
  127.             isHide = !isHide;
  128.         }
  129.         
  130.         /**
  131.          * drawTriangles でテクスチャを貼り付けるメソッド
  132.          * 参考: http://wonderfl.net/code/e7e1e28a9f20d73f11f0bb02d3e4b5f512c7cc0f
  133.          */
  134.         private function draw(e:Event = null):void {
  135.             var vertices:Vector.<Number> = new Vector.<Number>();
  136.             var indices:Vector.<int> = new Vector.<int>();
  137.             var uvtData:Vector.<Number> = new Vector.<Number>();
  138.             
  139.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  140.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  141.                     vertices[vertices.length] = vertexs[xx][yy].x
  142.                     vertices[vertices.length] = vertexs[xx][yy].y
  143.                     uvtData[uvtData.length] = xx / SEGMENT;
  144.                     uvtData[uvtData.length] = yy / SEGMENT;
  145.                 }
  146.             }
  147.             
  148.             for (var i:int = 0; i < SEGMENT - 1; i++) {
  149.                 for (var j:int = 0; j < SEGMENT - 1; j++) {
  150.                     indices.push(i * SEGMENT + j, i * SEGMENT + j + 1, (i + 1) * SEGMENT + j);
  151.                     indices.push(i * SEGMENT + j + 1, (i + 1) * SEGMENT + 1 + j, (i + 1) * SEGMENT + j);
  152.                 }
  153.             }
  154.             
  155.             var g:Graphics = sprite.graphics;
  156.             g.clear();
  157.             g.beginBitmapFill(Bitmap(loader.content).bitmapData);
  158.             g.drawTriangles(vertices, indices, uvtData);
  159.             g.endFill();
  160.         }
  161.         
  162.         /**
  163.          * Shiftキーを押してるとスローモーションになる
  164.          * macの挙動と同じように
  165.          */
  166.         private function keyUpHandler(e:KeyboardEvent):void {
  167.             if(e.keyCode == 16) isShift = false;
  168.         }
  169.         
  170.         private function keyDownHandler(e:KeyboardEvent):void {
  171.             if(e.keyCode == 16) isShift = true;
  172.         }
  173.     }
  174. }
noswf
  1. // forked from clockmaker's Ginny Effect Modoki
  2. /**
  3.  * Ginny Effect Modoki
  4.  * 
  5.  * 作ってしまいました。。。
  6.  * 
  7.  * Inspired by
  8.  * http://fladdict.net/blog/2009/09/flash-ginny-effect.html
  9.  * http://fladdict.net/exp/ginnyeffect/
  10.  * http://twitter.com/fladdict/status/3842965317
  11.  *
  12.  * Photo by 
  13.  * http://www.flickr.com/photos/88403964@N00/2662752839/ (by Yasu)
  14.  *
  15.  * 9/9(Wed) 04:00 first post http://twitter.com/clockmaker/status/3845570478
  16.  * ※ Mac OS X の隠しエフェクトの「Suck」っぽい http://bit.ly/11vMDh
  17.  */
  18. package {
  19.     import flash.display.*;
  20.     import flash.events.*;
  21.     import flash.geom.*;
  22.     import flash.net.*;
  23.     import flash.system.*;
  24.     import org.libspark.betweenas3.BetweenAS3;
  25.     import org.libspark.betweenas3.easing.*;
  26.     import org.libspark.betweenas3.tweens.ITween;
  27.     import com.bit101.components.*;
  28.     
  29.     [SWF(frameRate = 60)]
  30.     public class Main extends Sprite {
  31.         
  32.         private const IMAGE_URL:String = "http://farm4.static.flickr.com/3190/2662752839_249c6642b1.jpg";
  33.         private const IMG_W:int = 500;
  34.         private const IMG_H:int = 375;
  35.         private const SEGMENT:int = 20;
  36.         private var loader:Loader;
  37.         private var vertexs:Array;
  38.         private var sprite:Sprite;
  39.         private var isHide:Boolean = false;
  40.         private var isShift:Boolean = false;
  41.         
  42.         public function Main():void {
  43.             // init
  44.             stage.quality = StageQuality.MEDIUM;
  45.             graphics.beginFill(0x0);
  46.             graphics.drawRect(00465465);
  47.             
  48.             new Label(this360440"PLEASE CLICK STAGE")
  49.             
  50.             // load
  51.             var context:LoaderContext = new LoaderContext(true);
  52.             loader = new Loader();
  53.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE, compHandler);
  54.             loader.load(new URLRequest(IMAGE_URL), context);
  55.         }
  56.         
  57.         private function compHandler(e:Event):void {
  58.             sprite = new Sprite();
  59.             addChild(sprite);
  60.             vertexs = []
  61.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  62.                 vertexs[xx] = [];
  63.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  64.                     vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  65.                 }
  66.             }
  67.             draw();
  68.             addEventListener(Event.ENTER_FRAME, draw);
  69.             stage.addEventListener(MouseEvent.CLICK, clickHandler);
  70.             stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  71.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  72.         }
  73.         
  74.         private function clickHandler(e:MouseEvent):void {
  75.             var tweens:Array = [];
  76.             var xx:int, yy:int, delay:Number;
  77.             var px:Number = SEGMENT * (mouseX / IMG_W);
  78.             var py:Number = SEGMENT * (mouseY / IMG_H);
  79.             
  80.             if (!isHide) {
  81.                 for (xx = 0; xx < SEGMENT; xx++) {
  82.                     for (yy = 0; yy < SEGMENT; yy++) {
  83.                         vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  84.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py)) / 40;
  85.                         
  86.                         tweens.push(
  87.                             BetweenAS3.delay(
  88.                                 BetweenAS3.tween(vertexs[xx][yy], {
  89.                                     x : px * IMG_W / SEGMENT,
  90.                                     y : py * IMG_H / SEGMENT
  91.                                 },null, delay, Cubic.easeIn),
  92.                                 delay / 2
  93.                             )
  94.                         )
  95.                     }
  96.                 }
  97.             }else {
  98.                 // 重み付けが怪しい・・・
  99.                 var max:Number = 0;
  100.                 for (xx = 0; xx < SEGMENT; xx++) {
  101.                     for (yy = 0; yy < SEGMENT; yy++) {
  102.                         vertexs[xx][yy] = new Point(px * IMG_W / SEGMENT, py * IMG_H / SEGMENT);
  103.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))
  104.                         max = Math.max(max, delay);
  105.                     }
  106.                 }
  107.                 for (xx = 0; xx < SEGMENT; xx++) {
  108.                     for (yy = 0; yy < SEGMENT; yy++) {
  109.                         delay = (max - Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))) / 40;
  110.                         tweens.push(
  111.                             BetweenAS3.delay(
  112.                                 BetweenAS3.tween(vertexs[xx][yy], {
  113.                                     x : xx * IMG_W / SEGMENT,
  114.                                     y : yy * IMG_H / SEGMENT
  115.                                 },null, delay + 0.05, Quad.easeOut),
  116.                                 delay / 2
  117.                             )
  118.                         )
  119.                     }
  120.                 }
  121.             }
  122.             
  123.             var itw:ITween = BetweenAS3.parallelTweens(tweens);
  124.             if (isShift) itw = BetweenAS3.scale(itw, 5);
  125.             itw.play();
  126.             
  127.             isHide = !isHide;
  128.         }
  129.         
  130.         /**
  131.          * drawTriangles でテクスチャを貼り付けるメソッド
  132.          * 参考: http://wonderfl.net/code/e7e1e28a9f20d73f11f0bb02d3e4b5f512c7cc0f
  133.          */
  134.         private function draw(e:Event = null):void {
  135.             var vertices:Vector.<Number> = new Vector.<Number>();
  136.             var indices:Vector.<int> = new Vector.<int>();
  137.             var uvtData:Vector.<Number> = new Vector.<Number>();
  138.             
  139.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  140.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  141.                     vertices[vertices.length] = vertexs[xx][yy].x
  142.                     vertices[vertices.length] = vertexs[xx][yy].y
  143.                     uvtData[uvtData.length] = xx / SEGMENT;
  144.                     uvtData[uvtData.length] = yy / SEGMENT;
  145.                 }
  146.             }
  147.             
  148.             for (var i:int = 0; i < SEGMENT - 1; i++) {
  149.                 for (var j:int = 0; j < SEGMENT - 1; j++) {
  150.                     indices.push(i * SEGMENT + j, i * SEGMENT + j + 1, (i + 1) * SEGMENT + j);
  151.                     indices.push(i * SEGMENT + j + 1, (i + 1) * SEGMENT + 1 + j, (i + 1) * SEGMENT + j);
  152.                 }
  153.             }
  154.             
  155.             var g:Graphics = sprite.graphics;
  156.             g.clear();
  157.             g.beginBitmapFill(Bitmap(loader.content).bitmapData);
  158.             g.drawTriangles(vertices, indices, uvtData);
  159.             g.endFill();
  160.         }
  161.         
  162.         /**
  163.          * Shiftキーを押してるとスローモーションになる
  164.          * macの挙動と同じように
  165.          */
  166.         private function keyUpHandler(e:KeyboardEvent):void {
  167.             if(e.keyCode == 16) isShift = false;
  168.         }
  169.         
  170.         private function keyDownHandler(e:KeyboardEvent):void {
  171.             if(e.keyCode == 16) isShift = true;
  172.         }
  173.     }
  174. }
noswf
  1. // forked from clockmaker's Ginny Effect Modoki
  2. /**
  3.  * Ginny Effect Modoki
  4.  * 
  5.  * 作ってしまいました。。。
  6.  * 
  7.  * Inspired by
  8.  * http://fladdict.net/blog/2009/09/flash-ginny-effect.html
  9.  * http://fladdict.net/exp/ginnyeffect/
  10.  * http://twitter.com/fladdict/status/3842965317
  11.  *
  12.  * Photo by 
  13.  * http://www.flickr.com/photos/88403964@N00/2662752839/ (by Yasu)
  14.  *
  15.  * 9/9(Wed) 04:00 first post http://twitter.com/clockmaker/status/3845570478
  16.  * ※ Mac OS X の隠しエフェクトの「Suck」っぽい http://bit.ly/11vMDh
  17.  */
  18. package {
  19.     import flash.display.*;
  20.     import flash.events.*;
  21.     import flash.geom.*;
  22.     import flash.net.*;
  23.     import flash.system.*;
  24.     import org.libspark.betweenas3.BetweenAS3;
  25.     import org.libspark.betweenas3.easing.*;
  26.     import org.libspark.betweenas3.tweens.ITween;
  27.     import com.bit101.components.*;
  28.     
  29.     [SWF(frameRate = 60)]
  30.     public class Main extends Sprite {
  31.         
  32.         private const IMAGE_URL:String = "http://farm4.static.flickr.com/3190/2662752839_249c6642b1.jpg";
  33.         private const IMG_W:int = 500;
  34.         private const IMG_H:int = 375;
  35.         private const SEGMENT:int = 20;
  36.         private var loader:Loader;
  37.         private var vertexs:Array;
  38.         private var sprite:Sprite;
  39.         private var isHide:Boolean = false;
  40.         private var isShift:Boolean = false;
  41.         
  42.         public function Main():void {
  43.             // init
  44.             stage.quality = StageQuality.MEDIUM;
  45.             graphics.beginFill(0x0);
  46.             graphics.drawRect(00465465);
  47.             
  48.             new Label(this360440"PLEASE CLICK STAGE")
  49.             
  50.             // load
  51.             var context:LoaderContext = new LoaderContext(true);
  52.             loader = new Loader();
  53.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE, compHandler);
  54.             loader.load(new URLRequest(IMAGE_URL), context);
  55.         }
  56.         
  57.         private function compHandler(e:Event):void {
  58.             sprite = new Sprite();
  59.             addChild(sprite);
  60.             vertexs = []
  61.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  62.                 vertexs[xx] = [];
  63.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  64.                     vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  65.                 }
  66.             }
  67.             draw();
  68.             addEventListener(Event.ENTER_FRAME, draw);
  69.             stage.addEventListener(MouseEvent.CLICK, clickHandler);
  70.             stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  71.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  72.         }
  73.         
  74.         private function clickHandler(e:MouseEvent):void {
  75.             var tweens:Array = [];
  76.             var xx:int, yy:int, delay:Number;
  77.             var px:Number = SEGMENT * (mouseX / IMG_W);
  78.             var py:Number = SEGMENT * (mouseY / IMG_H);
  79.             
  80.             if (!isHide) {
  81.                 for (xx = 0; xx < SEGMENT; xx++) {
  82.                     for (yy = 0; yy < SEGMENT; yy++) {
  83.                         vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  84.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py)) / 40;
  85.                         
  86.                         tweens.push(
  87.                             BetweenAS3.delay(
  88.                                 BetweenAS3.tween(vertexs[xx][yy], {
  89.                                     x : px * IMG_W / SEGMENT,
  90.                                     y : py * IMG_H / SEGMENT
  91.                                 },null, delay, Cubic.easeIn),
  92.                                 delay / 2
  93.                             )
  94.                         )
  95.                     }
  96.                 }
  97.             }else {
  98.                 // 重み付けが怪しい・・・
  99.                 var max:Number = 0;
  100.                 for (xx = 0; xx < SEGMENT; xx++) {
  101.                     for (yy = 0; yy < SEGMENT; yy++) {
  102.                         vertexs[xx][yy] = new Point(px * IMG_W / SEGMENT, py * IMG_H / SEGMENT);
  103.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))
  104.                         max = Math.max(max, delay);
  105.                     }
  106.                 }
  107.                 for (xx = 0; xx < SEGMENT; xx++) {
  108.                     for (yy = 0; yy < SEGMENT; yy++) {
  109.                         delay = (max - Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))) / 40;
  110.                         tweens.push(
  111.                             BetweenAS3.delay(
  112.                                 BetweenAS3.tween(vertexs[xx][yy], {
  113.                                     x : xx * IMG_W / SEGMENT,
  114.                                     y : yy * IMG_H / SEGMENT
  115.                                 },null, delay + 0.05, Quad.easeOut),
  116.                                 delay / 2
  117.                             )
  118.                         )
  119.                     }
  120.                 }
  121.             }
  122.             
  123.             var itw:ITween = BetweenAS3.parallelTweens(tweens);
  124.             if (isShift) itw = BetweenAS3.scale(itw, 5);
  125.             itw.play();
  126.             
  127.             isHide = !isHide;
  128.         }
  129.         
  130.         /**
  131.          * drawTriangles でテクスチャを貼り付けるメソッド
  132.          * 参考: http://wonderfl.net/code/e7e1e28a9f20d73f11f0bb02d3e4b5f512c7cc0f
  133.          */
  134.         private function draw(e:Event = null):void {
  135.             var vertices:Vector.<Number> = new Vector.<Number>();
  136.             var indices:Vector.<int> = new Vector.<int>();
  137.             var uvtData:Vector.<Number> = new Vector.<Number>();
  138.             
  139.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  140.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  141.                     vertices[vertices.length] = vertexs[xx][yy].x
  142.                     vertices[vertices.length] = vertexs[xx][yy].y
  143.                     uvtData[uvtData.length] = xx / SEGMENT;
  144.                     uvtData[uvtData.length] = yy / SEGMENT;
  145.                 }
  146.             }
  147.             
  148.             for (var i:int = 0; i < SEGMENT - 1; i++) {
  149.                 for (var j:int = 0; j < SEGMENT - 1; j++) {
  150.                     indices.push(i * SEGMENT + j, i * SEGMENT + j + 1, (i + 1) * SEGMENT + j);
  151.                     indices.push(i * SEGMENT + j + 1, (i + 1) * SEGMENT + 1 + j, (i + 1) * SEGMENT + j);
  152.                 }
  153.             }
  154.             
  155.             var g:Graphics = sprite.graphics;
  156.             g.clear();
  157.             g.beginBitmapFill(Bitmap(loader.content).bitmapData);
  158.             g.drawTriangles(vertices, indices, uvtData);
  159.             g.endFill();
  160.         }
  161.         
  162.         /**
  163.          * Shiftキーを押してるとスローモーションになる
  164.          * macの挙動と同じように
  165.          */
  166.         private function keyUpHandler(e:KeyboardEvent):void {
  167.             if(e.keyCode == 16) isShift = false;
  168.         }
  169.         
  170.         private function keyDownHandler(e:KeyboardEvent):void {
  171.             if(e.keyCode == 16) isShift = true;
  172.         }
  173.     }
  174. }
noswf
  1. // forked from clockmaker's Ginny Effect Modoki
  2. /**
  3.  * Ginny Effect Modoki
  4.  * 
  5.  * 作ってしまいました。。。
  6.  * 
  7.  * Inspired by
  8.  * http://fladdict.net/blog/2009/09/flash-ginny-effect.html
  9.  * http://fladdict.net/exp/ginnyeffect/
  10.  * http://twitter.com/fladdict/status/3842965317
  11.  *
  12.  * Photo by 
  13.  * http://www.flickr.com/photos/88403964@N00/2662752839/ (by Yasu)
  14.  *
  15.  * 9/9(Wed) 04:00 first post http://twitter.com/clockmaker/status/3845570478
  16.  * ※ Mac OS X の隠しエフェクトの「Suck」っぽい http://bit.ly/11vMDh
  17.  */
  18. package {
  19.     import flash.display.*;
  20.     import flash.events.*;
  21.     import flash.geom.*;
  22.     import flash.net.*;
  23.     import flash.system.*;
  24.     import org.libspark.betweenas3.BetweenAS3;
  25.     import org.libspark.betweenas3.easing.*;
  26.     import org.libspark.betweenas3.tweens.ITween;
  27.     import com.bit101.components.*;
  28.     
  29.     [SWF(frameRate = 60)]
  30.     public class Main extends Sprite {
  31.         
  32.         private const IMAGE_URL:String = "http://farm4.static.flickr.com/3190/2662752839_249c6642b1.jpg";
  33.         private const IMG_W:int = 500;
  34.         private const IMG_H:int = 375;
  35.         private const SEGMENT:int = 20;
  36.         private var loader:Loader;
  37.         private var vertexs:Array;
  38.         private var sprite:Sprite;
  39.         private var isHide:Boolean = false;
  40.         private var isShift:Boolean = false;
  41.         
  42.         public function Main():void {
  43.             // init
  44.             stage.quality = StageQuality.MEDIUM;
  45.             graphics.beginFill(0x0);
  46.             graphics.drawRect(00465465);
  47.             
  48.             new Label(this360440"PLEASE CLICK STAGE")
  49.             
  50.             // load
  51.             var context:LoaderContext = new LoaderContext(true);
  52.             loader = new Loader();
  53.             loader.contentLoaderInfo.addEventListener(Event.COMPLETE, compHandler);
  54.             loader.load(new URLRequest(IMAGE_URL), context);
  55.         }
  56.         
  57.         private function compHandler(e:Event):void {
  58.             sprite = new Sprite();
  59.             addChild(sprite);
  60.             vertexs = []
  61.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  62.                 vertexs[xx] = [];
  63.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  64.                     vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  65.                 }
  66.             }
  67.             draw();
  68.             addEventListener(Event.ENTER_FRAME, draw);
  69.             stage.addEventListener(MouseEvent.CLICK, clickHandler);
  70.             stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  71.             stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  72.         }
  73.         
  74.         private function clickHandler(e:MouseEvent):void {
  75.             var tweens:Array = [];
  76.             var xx:int, yy:int, delay:Number;
  77.             var px:Number = SEGMENT * (mouseX / IMG_W);
  78.             var py:Number = SEGMENT * (mouseY / IMG_H);
  79.             
  80.             if (!isHide) {
  81.                 for (xx = 0; xx < SEGMENT; xx++) {
  82.                     for (yy = 0; yy < SEGMENT; yy++) {
  83.                         vertexs[xx][yy] = new Point(xx * IMG_W / SEGMENT, yy * IMG_H/SEGMENT);
  84.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py)) / 40;
  85.                         
  86.                         tweens.push(
  87.                             BetweenAS3.delay(
  88.                                 BetweenAS3.tween(vertexs[xx][yy], {
  89.                                     x : px * IMG_W / SEGMENT,
  90.                                     y : py * IMG_H / SEGMENT
  91.                                 },null, delay, Cubic.easeIn),
  92.                                 delay / 2
  93.                             )
  94.                         )
  95.                     }
  96.                 }
  97.             }else {
  98.                 // 重み付けが怪しい・・・
  99.                 var max:Number = 0;
  100.                 for (xx = 0; xx < SEGMENT; xx++) {
  101.                     for (yy = 0; yy < SEGMENT; yy++) {
  102.                         vertexs[xx][yy] = new Point(px * IMG_W / SEGMENT, py * IMG_H / SEGMENT);
  103.                         delay = Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))
  104.                         max = Math.max(max, delay);
  105.                     }
  106.                 }
  107.                 for (xx = 0; xx < SEGMENT; xx++) {
  108.                     for (yy = 0; yy < SEGMENT; yy++) {
  109.                         delay = (max - Math.sqrt((xx - px) * (xx - px) + (yy - py) * (yy - py))) /40;
  110.                         tweens.push(
  111.                             BetweenAS3.delay(
  112.                                 BetweenAS3.tween(vertexs[xx][yy], {
  113.                                     x : xx * IMG_W / SEGMENT,
  114.                                     y : yy * IMG_H / SEGMENT
  115.                                 },null, delay + 0.05, Quad.easeOut),
  116.                                 delay / 2
  117.                             )
  118.                         )
  119.                     }
  120.                 }
  121.             }
  122.             
  123.             var itw:ITween = BetweenAS3.parallelTweens(tweens);
  124.             if (isShift) itw = BetweenAS3.scale(itw, 5);
  125.             itw.play();
  126.             
  127.             isHide = !isHide;
  128.         }
  129.         
  130.         /**
  131.          * drawTriangles でテクスチャを貼り付けるメソッド
  132.          * 参考: http://wonderfl.net/code/e7e1e28a9f20d73f11f0bb02d3e4b5f512c7cc0f
  133.          */
  134.         private function draw(e:Event = null):void {
  135.             var vertices:Vector.<Number> = new Vector.<Number>();
  136.             var indices:Vector.<int> = new Vector.<int>();
  137.             var uvtData:Vector.<Number> = new Vector.<Number>();
  138.             
  139.             for (var xx:int = 0; xx < SEGMENT; xx++) {
  140.                 for (var yy:int = 0; yy < SEGMENT; yy++) {
  141.                     vertices[vertices.length] = vertexs[xx][yy].x
  142.                     vertices[vertices.length] = vertexs[xx][yy].y
  143.                     uvtData[uvtData.length] = xx / SEGMENT;
  144.                     uvtData[uvtData.length] = yy / SEGMENT;
  145.                 }
  146.             }
  147.             
  148.             for (var i:int = 0; i < SEGMENT - 1; i++) {
  149.                 for (var j:int = 0; j < SEGMENT - 1; j++) {
  150.                     indices.push(i * SEGMENT + j, i * SEGMENT + j + 1, (i + 1) * SEGMENT + j);
  151.                     indices.push(i * SEGMENT + j + 1, (i + 1) * SEGMENT + 1 + j, (i + 1) * SEGMENT + j);
  152.                 }
  153.             }
  154.             
  155.             var g:Graphics = sprite.graphics;
  156.             g.clear();
  157.             g.beginBitmapFill(Bitmap(loader.content).bitmapData);
  158.             g.drawTriangles(vertices, indices, uvtData);
  159.             g.endFill();
  160.         }
  161.         
  162.         /**
  163.          * Shiftキーを押してるとスローモーションになる
  164.          * macの挙動と同じように
  165.          */
  166.         private function keyUpHandler(e:KeyboardEvent):void {
  167.             if(e.keyCode == 16) isShift = false;
  168.         }
  169.         
  170.         private function keyDownHandler(e:KeyboardEvent):void {
  171.             if(e.keyCode == 16) isShift = true;
  172.         }
  173.     }
  174. }
noswf
Get Adobe Flash Player