Googlecode : quasimondolibs
http://code.google.com/p/quasimondolibs/
@quasimondoさんのquasimondolib、Flashの神らしい神々しいコードばかりです。
天才の紡ぎだすActionscriptは見てるだけでも楽しめます。
せっかくなので使っても楽しみたいけど、残念ながらドキュメントが付属していません。
ソースにもコメントが全くと言っていいほど入ってなかったりで不親切だよなぁ。 🙁
勝手に使わせていただいているので文句は言えません、ぼちぼちソースを読み解きながら使ってみることにします。
com.quasimondo.tools.MarchingAntsRect
Antsってクラス名についているように蟻の行列のような破線アニメーションを作り出します。
Photoshop などの 選択時の破線アニメーションのようなものです。
MarchingAntsRect Demo
マウスダウンで120×90の大きさの破線アニメーションをマウス位置に生成します。
マウスアップでアニメーションが止まります。
import com.quasimondo.tools.MarchingAntsRect; var ants:MarchingAntsRect; function setUp ():void { ants = new MarchingAntsRect(); addChild(ants as Shape); stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } setUp(); function antsDraw (e:MouseEvent):void { ants.draw(new Rectangle(e.stageX, e.stageY, 120, 90)); } function mouseDownHandler (e:MouseEvent):void { antsDraw(e) stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function mouseMoveHandler (e:MouseEvent):void { antsDraw(e); } function mouseUpHandler (e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler) ants.stop(); } |
デフォルトでも充分なのですがCONSTRUCTORで色やパターンの設定ができます。
public function MarchingAntsRect( colors:Array = null, pattern:Array = null ) // default colors colors = [ 0xff000000, 0xffffffff ]; |
colors
とpattern
のlengthは一致していないといけないようですが、一致していないと強制的にcolors
のlengthにしてしまいます。
MarchingAntsRect.draw
でどこにどの大きさでアニメーションするかを設定します。
public function draw( rectangle:Rectangle, animate:Boolean = true, steps:Number = 1 ):void |
ドラッグする時に使ったりするといいかも。