Zoom in then zoom out loop

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;

}

Try with this, I didn’t test it though.

private float initializationTime;
private float CameraDistance;
private float startTime;
public float duration = 5f;
private float ZoomTime;

// Change min and max zoom values from the inspector
public float MinZoom = 105 ;
public float MaxZoom = 130 ;
private float TargetZoom ;
private float FromZoom ;

void Start ()
{
	startTime = Time.time;
	CameraDistance = Camera.main.orthographicSize ;

    // You may want to change the FromZoom and TargetZoom here
	FromZoom = MinZoom ;
	TargetZoom = MaxZoom ;
}

// Update is called once per frame
void Update () 
{
	float t = (Time.time - startTime) / duration;

	// Check if you have reached your "destination". Switch from zoom and target zoom if yes
	if ( Math.abs( CameraDistance, TargetZoom ) < 1 ) 
	{
		// Compare current target zoom. Don't use == since you are comparing floats. 
		if( Math.abs( TargetZoom, MinZoom ) < 0.01f )
		{
			FromZoom = MinZoom ;
			TargetZoom = MaxZoom ;
		}
		else
		{
			FromZoom = MaxZoom ;
			TargetZoom = MinZoom ;
		}
	}
	
	CameraDistance = Mathf.SmoothStep (FromZoom, TargetZoom, t);
	Camera.main.orthographicSize = CameraDistance;
}

Why not if(Mathf.Approximately(CameraDistance, YOURGOAL))?

So during zoomin YOURGOAL would be i guess 105 and during zoomout 130? =)

An easy way of doing this would be

float cameraSize = (Mathf.Sin(Time.time * zoomSpeed) + 1 / 2 * (yourMaxSize-yourMinSize) + yourMinSize;

Just set your camera size to cameraSize after this.

If you want the zoom to be at constant speed, you can use a triangle wave function instead:

float cameraSize = Mathf.Abs((Time.time * zoomSpeed)% 2 - 1) * (yourMaxSize-yourMinSize) + yourMinSize;