なんだかちょっと旗っぽい
なみなみ+なみなみで旗っぽいいいいいい
* @author minon
// forked from minon's なみなみ
/**
* なみなみ+なみなみで旗っぽいいいいいい
* @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.x = stage.mouseX-50;
_canvas.y = stage.mouseY-100;
_canvas.graphics.clear();
_canvas.graphics.lineStyle( 1, 0xFF0000 );
var h:int = 80;
var p:pt;
var p2:pt;
for ( var i:int = 0 ; i < _pArray.length-1 ; i++ ) {
p = _pArray[i];
p2 = _pArray[i + 1];
_canvas.graphics.moveTo( p.x, p.y );
_canvas.graphics.lineTo( p2.x, p2.y );
_canvas.graphics.lineTo( p2.x, p2.y+h );
_canvas.graphics.lineTo( p.x, p.y+h );
_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;
}
}