noisy
♥0 |
Line 45 |
Modified 2011-04-09 01:43:47 |
MIT License
archived:2017-03-20 02:34:13
ActionScript3 source code
/**
* Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aXso
*/
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
private const TABLE_MAX:uint = 200;
private var _table:Array;
private var _frame:uint;
public function FlashTest() {
reset();
this.addEventListener(Event.ENTER_FRAME, proc);
}
private function proc(e:Event):void {
++_frame;
this.graphics.clear();
if (_frame > (span * TABLE_MAX) + 400) {
reset();
return;
}
var span:uint = 1;
for (var index:uint = 0; index < TABLE_MAX; ++index) {
var border:uint = span * index;
if (_frame < border) continue;
var height:Number = 400;
var target:Number = height * _table[index];
var ratio:Number = (_frame - border) / 10.0;
if (ratio > 1.0) ratio = 1.0;
var width:Number = height / TABLE_MAX;
var down:Number = (height - target) * ratio;
this.graphics.beginFill(0x000000);
this.graphics.drawRect(32 + (index * width), 32, width, target * ratio);
this.graphics.endFill();
this.graphics.beginFill(0x606060);
this.graphics.drawRect(32 + (index * width), 432 - down, width, down);
this.graphics.endFill();
}
}
private function reset():void {
_table = new Array();
for (var index:uint = 0; index < TABLE_MAX; ++index) {
_table.push(Math.random());
}
_frame = 0;
}
}
}