All pastes #493606 Raw Edit

paccer

public text v1 · immutable
·published 2007-05-17 21:11 UTC
rendered paste body
onClipEvent (load) {
	points = Array();
	points.xx = Array();
	points.yy = Array();
	var arrlen;
	var pointdist;
	bumpyness = 20;
	mowidth = Stage.width;
	moheight = Stage.height;
}
onClipEvent (enterFrame) {
	clear();
	function drawpoints(style, thickness) {
		arrlen = points.xx.length;
		if (style == "dot") {
			for (i=0; i<arrlen; i++) {
				drawdot(points.xx[i], points.yy[i], thickness);
			}
		}
		if (style == "line") {
			lineStyle(thickness, 0x000000, 100);
			moveTo(points.xx[0], points.yy[0]);
			for (i=0; i<arrlen; i++) {
				lineTo(points.xx[i], points.yy[i]);
			}
		}
	}
	function drawdot(xcord, ycord, thickness) {
		lineStyle(thickness, 0x000000, 100);
		moveTo(xcord, ycord);
		lineTo(xcord+0.5, ycord);
	}
	function makepoints(fineness) {
		mov_w = mowidth;
		pointdist = (mowidth/fineness);
		for (i=(0-pointdist); i<=mov_w; i += pointdist) {
			points.xx.push(i);
			points.yy.push((moheight/2)+random(bumpyness));
		}
		//trace(points.xx+"\n"+points.yy)
		//trace(points.xx.length)
	}
	if (!init) {
		init = true;
		//detail
		makepoints(10);
	}
	function calcmove() {
		arrlen = points.xx.length;
		lastpointxpos = points.xx[arrlen-1];
		firstpointxpos = points.xx[0];
		if (lastpointxpos>mowidth+pointdist) {
			points.xx.pop();
			points.xx.unshift(firstpointxpos-pointdist);
			points.yy.pop();
			points.yy.unshift((moheight/2)+random(bumpyness));
		}
		if (firstpointxpos<0-pointdist) {
			points.xx.shift();
			points.xx.push(lastpointxpos+pointdist);
			points.yy.shift();
			points.yy.push((moheight/2)+random(bumpyness));
		}
		//style, thickness      
		//drawpoints("line", 1);
		drawpoints("line", 1);
		//
		for (i=0; i<arrlen; i++) {
			if (_root._xmouse<mowidth/2) {
				points.xx[i] -= ((mowidth/2)-_xmouse)/10;
			} else {
				points.xx[i] += (_xmouse-(mowidth/2))/10;
			}
		}
		//trace(points.xx);
	}
	calcmove();
}