Reflection/plugin/intro

리버티게임, 모두가 만들어가는 자유로운 게임
var showIntro = function(v){
	var location = new Array(10);
	var visibility = new Array(10);
	var str = "reflection";
	for(var i=0; i<10; i++){
		location[i] = (v>i*10 ? (v>i*10+10 ? 10 : v-i*10) : 0) * 5 + i*60 - 15;
		visibility[i] = (v>i*10 ? (v>i*10+10 ? 10 : v-i*10) : 0);
	}
	
	if(v>130){
		showIntro2(0);
		return;
	}
	
	ctx.clearRect(0, 0, 600, 600);
	ctx.fillStyle = "black";
	ctx.fillRect(0, 0, 600, 600);
	ctx.fillStyle = "white";
	ctx.font = "italic 40px 'Trebuchet MS'";
	ctx.textAlign="center"; 
	
	for(var i=0; i<10; i++){
		var tmp = visibility[i] * 25.6;
		ctx.fillStyle = "rgb(" + tmp + ", " + tmp + ", " + tmp + ")";
		ctx.fillText(str[i], location[i], 300);
	}
	
	setTimeout(showIntro, 25, v+1);
};

var showIntro2 = function(v){
	var location = new Array(10);
	var str = "reflection";
	
	if(v>40) return;
	
	for(var i=0; i<10; i++){
		location[i] = i*60 + 45 + (300 - (i*60+45)) / 58 * v;
	}
	
	ctx.clearRect(0, 0, 600, 600);
	ctx.fillStyle = "black";
	ctx.fillRect(0, 0, 600, 600);
	ctx.fillStyle = "white";
	ctx.font = "italic 40px 'Trebuchet MS'";
	ctx.textAlign="center"; 
	
	for(var i=0; i<10; i++){
		ctx.fillText(str[i], location[i], 300);
	}
	
	setTimeout(showIntro2, 25, v+1);
};