なみなみ
とりあえずなみなみなみなみなみなみ~~~~~~
* @author minon
/**
* とりあえずなみなみなみなみなみなみ~~~~~~
* @author minon
*/
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.utils.getTimer;
[SWF (width="465",height="465",frameRate="60",backgroundColor="#000000")]
public class FlashTest extends Sprite {
public var _canvas:Sprite;
public var _n:int = 18;
public var _l:int = 160;
public var _pArray:Array = [];
public function FlashTest() {
this.addChild( _canvas = new Sprite() );
for ( var i:int = 0 ; i < _n ; i++ ) {
_pArray.push( new pt( _l / _n * i + 50, 50 ) );
}
this.addEventListener( Event.ENTER_FRAME, update );
this.addEventListener( Event.ENTER_FRAME, render );
}
private function update(e:Event):void {
var p:pt;
for ( var i:int = 0 ; i < _pArray.length ; i++ ) {
p = _pArray[i];
p.y = p.yy + Math.cos( i - getTimer()/100 ) * ( 8 * ( i / _pArray.length ) );
}
}
public function render(e:Event):void {
_canvas.graphics.clear();
_canvas.graphics.lineStyle( 1, 0xFF0000 );
for ( var i:int = 0 ; i < _pArray.length ; i++ ) {
var p:pt = _pArray[i];
if ( i == 0 ) {
_canvas.graphics.moveTo( p.x, p.y );
_canvas.y = -( p.y - p.yy );
}
else {
_canvas.graphics.lineTo( p.x, p.y );
}
}
}
}
}
class pt {
public var x:Number;
public var y:Number;
public var xx:Number;
public var yy:Number;
public function pt( _x:Number = 0, _y:Number = 0 ) {
this.xx = this.x = _x;
this.yy = this.y = _y;
}
}