C# Pulsating movement

I’ve been scratching my head over this (sorry, I’m very new to this) and I’ve decided to look for help.

I’m looking to make a movement script where my character moves towards the mouse in a pulsing kind of movement. So the object’s movement speed would be 5f when horizontal axis is picked up, but it will only move for a second before decelerating and then accelerating again until I let go of the movement.

Something like how a jellyfish moves.

Edit Edit: Hoping updated script gives a better idea of what I’m trying to accomplish

Rigidbody rb;
public float moveSpeed;
public float maxSpeed;
private Vector3 input;

// Use this for initialization
void Start () {
	rb = GetComponent<Rigidbody>();
}

// Update is called once per frame
void FixedUpdate () {
	input = new Vector3 (Input.GetAxis("Horizontal 0"), Input.GetAxis("Vertical 0"), 0);
	if (rb.velocity.magnitude > maxSpeed){
		rb.velocity = rb.velocity.normalized * maxSpeed;
	}
	if (Input.GetAxisRaw("Horizontal 0") !=0){
		Move();
		//InvokeRepeating("Move",2f,5f);

	} else if (Input.GetAxisRaw("Vertical 0") !=0){
		Move();
		//InvokeRepeating("Move",2f,5f);

	} else {
		Stop();
	}
}


void Move(){
	rb.AddForce(input * moveSpeed);
	rb.drag = 0;

}

void Stop(){
	rb.drag = 1;
}

Thanks in advance to anyone offering a solution.

You could try multiplying moveSpeed by Mathf.Sin(Time.realtimeSinceStartup).

 void Move(){
     rb.AddForce(input * moveSpeed * Mathf.Sin(Time.realtimeSinceStartup * 0.5f));
     rb.drag = 0;
 }

You can change the value being multiplied by Time.realtimeSinceStartup (in this case, 0.5f) to vary the frequency.

Alternatively, you could use an animation curve to get more fine-grained control of the movement, e.g. a non symmetrical pulsating movement.

 public AnimationCurve movement;
 void Move(){
     rb.AddForce(input * moveSpeed * movement.Evaluate((Time.realtimeSinceStartup * 0.5f) % 1f);
     rb.drag = 0;
 }

Then, in the inspector, set up an animation curve (between 0 and 1 on the x axis).