Animation scripting.

Hello. i work in JavaScripting. I try to animate a knife. I need to change the rotation : x to -50 to cut. But i need to be animated. Smooth move. And before to go rotation x to 0.

cutstep : int = 0;
if(Input.GetButtonDown("Fire1"))
{
if(cutstep == 0)
{
if(SwitchWeapons.Weaponcut == 1)
{
cutstep += 1;
}
}
}
if(cutstep == 1)
{
transform.Rotate(Vector3(-50,0,0));
cutwait();
}
if(cutstep == 2)
{
transform.Rotate(Vector3(50,0,0));
cutwait01();
cutwait02();
}
}

function cutwait()
{
yield WaitForSeconds(0.01);
cutstep = 2;
}
function cutwait01()
{
yield WaitForSeconds(0.01);

}

function cutwait02()
{
yield WaitForSeconds(0.01);
cutstep = 0;
}

It works but make fast move and look ugly… I can’t use animation for this object becouse is a prefab ,and don’t work i can’t make a new animation, and i try to make a script for animation but is so fast… Thx.

var isAnimate = false;

function Update() {
	if (Input.GetButtonDown("Fire1")) {
		if (!isAnimate) Cut();
	}
}


function Cut() {
	isAnimate = true;
	yield Animate(new Vector3(0,0,0), new Vector3(-50,0,0), 1);
	yield Animate(new Vector3(-50f,0f,0f), new Vector3(0,0,0), 1);
	isAnimate = false;
}


function Animate(_from : Vector3, _to : Vector3, _speed : float) {
	var timer : float = 0;
	while (timer <= 1f) {
		timer += 0.01f * _speed;
		transform.eulerAngles = Vector3.Lerp(_from, _to, timer);
		yield WaitForEndOfFrame();
		//or WaitForSeconds(0.01f);
	}
	transform.eulerAngles = _to;
	return;
}