Add Easing to Transform.Rotate


I'm using a C# script to rotate an object based off a two finger rotate gesture. The following script works great, but I'd like to add a little easing to the rotation. I've tried implementing some easing equations, but can't get things to work.

I thought about trying to use Quaternion.Slerp, but I need angleThen and angleNow to be of type Quaternion and I'm not sure how to convert these values using Quaternion constructor.

transform.rotation = Quaternion.Slerp (angleThen, angleNow, Time.time * 0.4);

I'd greatly appreciate any help or advice!



float zDistanceFromCamera = Vector3.Distance(Camera.main.transform.position,transform.position);
                Vector3 screenPosition0 = new Vector3(touch0.position.x,touch0.position.y,zDistanceFromCamera);
                Vector3 lastScreenPosition0 = new Vector3(touch0.position.x - touch0.deltaPosition.x,touch0.position.y - touch0.deltaPosition.y,zDistanceFromCamera);

                Vector3 screenPosition1 = new Vector3(touch1.position.x,touch1.position.y,zDistanceFromCamera);
                Vector3 lastScreenPosition1 = new Vector3(touch1.position.x - touch1.deltaPosition.x,touch1.position.y - touch1.deltaPosition.y,zDistanceFromCamera);

                float angleNow = Mathf.Atan2(screenPosition0.x - screenPosition1.x, screenPosition0.y - screenPosition1.y) * Mathf.Rad2Deg;
                float angleThen = Mathf.Atan2(lastScreenPosition0.x - lastScreenPosition1.x, lastScreenPosition0.y - lastScreenPosition1.y) * Mathf.Rad2Deg;

                float angleDelta = (angleNow - angleThen);
                transform.Rotate(Vector3.up, angleDelta, Space.Self);

You could try something like:

    var str : float = RotationSpeed * Time.deltaTime;
    transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.AngleAxis(0, Vector3.up), str);