Moving object disappears then comes back

Hey, so I’ve got a script where a 2D obstacle is supposed to move up and down on a loop. The script works fine, but for a second or two, the obstacle just goes invisible and then comes back. However, it only goes invisible in the game area, not in the scene area. I’m going to attach my code and a video link to show whats happening. Here’s the video: Disappearing Object on Vimeo.
Here’s the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpikeMovement : MonoBehaviour {

    public Transform farEnd;
    private Vector3 frometh;
    private Vector3 untoeth;
    public float secondsForOneLength = 20f;

	// Use this for initialization
	void Start () {
        
        frometh = transform.position;
        untoeth = farEnd.position;
	}
	
	// Update is called once per frame
	void Update () {
        
        transform.position = Vector3.Lerp(frometh, untoeth,
  Mathf.SmoothStep(0f, 1f,
   Mathf.PingPong(Time.time / secondsForOneLength, 1f)
 ));
	
    }
}

It seems like your script is written out and working correctly, however…

The issue is probbably that it is lerping through the Z axis, making it go behind and in front of the background.
_
Make sure that you are using a 2D solution for this. Replace your Vector3.Lerp with a Vector2.Lerp instead.
_
Hope this helps you out! If not, let me know.
_