How to make a script for "jetpack" boost animation

Hi, im fairly new to unity and scripting, and need help in making a script for my spaceships boost animation to play when i hold down Left mouse button and go back to “idle” animation when LMB is released. At the moment i dont have anything else in my script except movement. Farthest i’ve gotten with it is gettin it to change the animation to boost but it blinked the boost on and off and wouldn’t go back to idle.

Game is 2D

if someone could make me clear instructions on how this is done.

Here’s my script for the spaceship.

using UnityEngine;
using System.Collections;

public class ufocontrols : MonoBehaviour {

public float jetpackForce = 75.0f;
public float forwardMovementSpeed = 3.0f;

Animator animator;

// Use this for initialization
void Start () {
	animator = this.GetComponent<Animator> ();
}

void Update ()
{

}

// Update is called once per frame
void FixedUpdate () 
{
	bool jetpackActive = Input.GetButton("Fire1");
	
	if (jetpackActive) {
	
		GetComponent<Rigidbody2D> ().AddForce (new Vector2 (0, jetpackForce));
	}

		Vector2 newVelocity = GetComponent<Rigidbody2D>().velocity;
		newVelocity.x = forwardMovementSpeed;
		GetComponent<Rigidbody2D>().velocity = newVelocity;

}

}

no but i found out that i was using animator wrong since they included “Entry and Exit” in the animator and i wasnt using them at all, i just made transitions between the animations not from entry to animation to exit. and that fixed my problem.

but thanks anyways and i will certainly try that out if it would work better !!