using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SuccessMan : MonoBehaviour
{

    public float Duration = 2;
	// Use this for initialization
	void Start ()
	{
	    StartCoroutine(Routine());
	}

    IEnumerator Routine()
    {
        var originPos = transform.position;
        var originScale = transform.localScale;
        var destPos = new Vector3(0,0,0);
        var destScale = new Vector3(1,1,0);
        var startTime = Time.time;
        while (Time.time < startTime + Duration)
        {
            yield return new WaitForEndOfFrame();
            transform.position = Vector3.Lerp(originPos, destPos, (Time.time - startTime) / Duration);
            transform.localScale = Vector3.Lerp(originScale, destScale, (Time.time - startTime)/Duration);
            transform.Rotate(Vector3.forward,720 * Time.deltaTime);
        }
        
    }
}
