Hi everyone. I would like to zoom in and then zoom out at the original zoom. All this in a loop. Here’s my incomplete code:
I Don’t know how to put a condition that change my from the zoom in to the zoom out. Thank you.
private float initializationTime;
private float CameraDistance;
private float startTime;
public float duration = 5f;
private float ZoomTime;
void Start () {
startTime = Time.time;
}
// Update is called once per frame
void Update ()
{
float t = (Time.time - startTime) / duration;
if ()
{
CameraDistance = Mathf.SmoothStep (105f, 130f, t);
Camera.main.orthographicSize = CameraDistance;
}
else
{
CameraDistance = Mathf.SmoothStep (130f, 105f, t);
Camera.main.orthographicSize = CameraDistance;