yp-t8 site curveTo source

yp-t8 site curveTo source

Drawing API based curve line

onClipEvent(load) {
	cnt = 0;
	curve = 15;
	hertz = 600;
	speed = 15;
	degree = 45;
	width = 100;
	var tX = [];
	var tY = [];
}
onClipEvent (enterFrame) {
	cnt++;
	clear();
	tmpX = width/(curve+1);
	lineStyle(1, 0x000000, 30);
	moveTo(-20, 0);
	lineTo((tmpX*0)-20, tY1);
	tX[0] = 0;
	tY[0] = 0;
	for (var i = 0; i<=(curve+1); i++) {
		tX[i] = tmpX*i;
		tY[i] = (Math.sin(Math.PI/180*((cnt*speed)+(i*degree))))*hertz;
	}
	tX[curve+2] = width;
	tY[curve+2] = 0;
	for (var i=1; i<(curve+1); i += 2) {
		curveTo(tX[i], tY[i], (tX[i+2]-tX[i])/2+tX[i], (tY[i+2]-tY[i])/2+tY[i]);
	}
}


About this entry