In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

ひもっぽい何か

参考

bouze's hybrid-brush-05
http://wonderfl.kayac.com/code/ff5d0155b7268a766c3bc22da04be974a0778d0e

...
@author tkinjo
Get Adobe Flash player
by tkinjo 09 Jun 2009
/**
 * Copyright tkinjo ( http://wonderfl.net/user/tkinjo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eBPJ
 */

// forked from tkinjo's 点の追従
package  
{
	/**
	 * 参考
	 * 
	 * bouze's hybrid-brush-05
	 * http://wonderfl.kayac.com/code/ff5d0155b7268a766c3bc22da04be974a0778d0e
	 */
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Point;
	
	[SWF(width="465", height="465", frameRate="60", backgroundColor="0xffffff")]
	/**
	 * ...
	 * @author tkinjo
	 */
	public class Main extends Sprite {
		
		// 点の数
		private const dotNum:int = 100;
		
		// 点の半径
		private const dotRadius:uint = 1;
		
		// 点と点との距離
		private const distance:uint = 5;
		
		
		
		
		
		// 点の配列
		private var dots:Array = new Array();
		
		/**
		 * コンストラクタ
		 */
		public function Main() {
			
			// ループカウンタ
			var i:int;
			
			// 点の作成
			for ( i = 0; i < dotNum; i++) {
				
				var dot:Point = new Point( mouseX, mouseY );
				dots.push( dot );
			}
			
			
			
			// フレームごとにループ
			addEventListener(Event.ENTER_FRAME, function( event:Event ):void {
					
					/** --------------------------------------------------
					 * 計算
					 */
					for (i = 0; i < dotNum; i++) {
						
						// 座標の算出
						if ( i == 0 ) {
							
							dots[ i ].x = mouseX;
							dots[ i ].y = mouseY;
							
						} else {
							
							var angle:Number = Math.atan2( dots[ i ].y - dots[ i - 1 ].y, dots[ i ].x - dots[ i - 1 ].x );
							dots[ i ].x = dots[ i - 1 ].x + distance * Math.cos( angle );
							dots[ i ].y = dots[ i - 1 ].y + distance * Math.sin( angle );
						}
					}
					
					
					/** --------------------------------------------------
					 * 描画
					 */
					graphics.clear();
					graphics.beginFill( 0 );
					
					for (i = 0; i < dotNum; i++)
						graphics.drawCircle( dots[ i ].x, dots[ i ].y, dotRadius );
					
				} );
		}
	}
}