using UnityEngine;
using System.Collections;

public class BannerScript : MonoBehaviour {

	private float count = 0;
	public float speed;
	public float dist;
	public Vector3 dir;
	public Vector3 startPos;

	// Use this for initialization
	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
		count += Time.deltaTime;
		float anim = count / speed;
		anim = Mathf.Pow (anim, 0.7f);
		if (anim > 1) anim = 1;

		Vector3 vec2 = startPos + dist * dir;
		transform.position = Vector3.Lerp(vec2, startPos, anim);
	}

	public void SetAway() {
		transform.position = startPos + dist * dir;
	}
}
