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

それっぽくなったゆらゆらの旗

無理やり隙間を埋めて、なんとか計算合うようにした。これでサイズ変えても大丈夫。
* けど、101行目あたりでなぜ分割数を乗算する必要があるのかがよくわからんち、
* なんで?なんで?誰か教えてぇぇぇぇ。
* @author minon
Get Adobe Flash player
by minon 01 Mar 2009
// forked from minon's 光と影のゆらゆら~
// forked from minon's さらにゆらゆら~
// forked from minon's ゆらゆら~
// forked from minon's なんだかちょっと旗っぽい
// forked from minon's なみなみ
/**
 * 無理やり隙間を埋めて、なんとか計算合うようにした。これでサイズ変えても大丈夫。
 * けど、101行目あたりでなぜ分割数を乗算する必要があるのかがよくわからんち、
 * なんで?なんで?誰か教えてぇぇぇぇ。
 * @author minon
 */
package {
	
	import flash.display.*;
	import flash.events.Event;
	import flash.geom.*;
	import flash.net.URLRequest;
	import flash.system.LoaderContext;
	import flash.utils.getTimer;
	import net.hires.debug.Stats;
	
	[SWF (width="465",height="465",frameRate="60",backgroundColor="#000000")]
	public class FlashTest extends Sprite {
		
		public var _outline:Sprite;
		public var _canvas:Bitmap;
		
		public var _n:int = 20;
		public var _l:int = 160;
		
		public var _t:Number = 0;
		
		public var _pArray:Array = [];
		public var _src:BitmapData;
		
		public function FlashTest() {
			
			this.addChild( new Stats() );
			
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener( Event.COMPLETE, this.init );
			loader.load( new URLRequest("http://labs.minomix.net/img/minon.jpg"), new LoaderContext(true) );
			
		}
		
		public function init(e:Event):void {
			
			var loader:Loader = LoaderInfo( e.target ).loader;
			_src = Bitmap( loader.content ).bitmapData;
                        
			this.addChild( _canvas = new Bitmap( new BitmapData( 465, 465, true, 0x00FF0000 ) ) );
			this.addChild( _outline = new Sprite() );
			
			var u:Number = _src.width / _n;
			for ( var i:int = 0 ; i < _n ; i++ ) {
				
				var bmp:BitmapData = new BitmapData(u, _src.height);
				bmp.copyPixels( _src, new Rectangle( u * i, 0, u, _src.height ), new Point() );
				_pArray.push( new pt( _l / _n * i + 50, 50, bmp ) );
				
			}
			
			this.addEventListener( Event.ENTER_FRAME, update );
			this.addEventListener( Event.ENTER_FRAME, render );
			
		}
		
		private function update(e:Event):void {
			
			_t += 0.1
			
			var p:pt;
			for ( var i:int = 0 ; i < _pArray.length ; i++ ) {
				p = _pArray[i];
				p.y = p.yy + Math.sin( i*0.5 - _t ) * ( 8 * ( i / _pArray.length ) * 1.5 );
				p.x = p.xx + Math.sin( i*0.5 - _t ) * ( 8 * ( i / _pArray.length ) );
				
			}
			
		}
		
		public function render(e:Event):void {
			
			//_outline.graphics.clear();
			//_outline.graphics.lineStyle( 2, 0xFF0000 );
			
			var h:int = 160;
			var p:pt;
			var p2:pt;
			
			var bmp:BitmapData = _canvas.bitmapData;
			bmp.fillRect( new Rectangle( 0, 0, 465, 465 ), 0 );
			
			for ( var i:int = 0 ; i < _pArray.length-1 ; i++ ) {
				p = _pArray[i];
				p2 = _pArray[i + 1];
				
				var tx:Number = p.x;
				var ty:Number = p.y;
				var a:Number = ( p2.x - p.x ) / p.bmp.width + 0.2;
				var b:Number = ( p2.y - p.y ) / p.bmp.height * _n;
				var c:Number = 0;
				var d:Number = h / p.bmp.height;
				
				var mtx:Matrix = new Matrix( a, b, c, d, tx, ty );
				
				var y:Number = p.y - p.yy;
				
				var ct:ColorTransform = new ColorTransform();
				ct.redOffset = ct.greenOffset = ct.blueOffset = -y*5;
				
				bmp.draw( p.bmp, mtx, ct, null, null, true );
				
				/*
				_outline.graphics.moveTo( p.x, p.y );
				_outline.graphics.lineTo( p2.x, p2.y );
				_outline.graphics.lineTo( p2.x, p2.y+h );
				_outline.graphics.lineTo( p.x, p.y+h );
				_outline.graphics.lineTo( p.x, p.y );
				*/
				
			}
		}
	}
}

import flash.display.*;

class pt {
	public var x:Number;
	public var y:Number;
	
	public var xx:Number;
	public var yy:Number;
	
	public var bmp:BitmapData;
	
	public function pt( _x:Number = 0, _y:Number = 0, _bmp:BitmapData = null ) {
		this.xx = this.x = _x;
		this.yy = this.y = _y;
		bmp = _bmp;
	}
}