単振動
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hpcz
*/
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(frameRate="0")]
public class FlashTest extends Sprite {
public function FlashTest() {
var _y:Number = 100;
var _v:Number = 0;
var K:Number = 0.001;
var _x:int = 0;
graphics.lineStyle(1);
addEventListener(Event.ENTER_FRAME, function(e:Event):void {
var v = _v;
_v -= (_y * K);
_y += _v; // what happens if this line is _y += v; ?
if (_x == 0)
graphics.moveTo(_x, stage.stageHeight / 2 + _y);
else
graphics.lineTo(_x, stage.stageHeight / 2 + _y);
if (++_x > stage.stageWidth) {
graphics.clear(); _x = 0;
graphics.lineStyle(1);
}
});
}
}
}