How to make the animation run longer or shorter?

So i have the player,which is a cube and i want it to “jump” to a chosen empty object position.I managed to move the player from it’s original place with vector3.MoveTwords(),but in the same time i want to play an animation that shows the cube how it jumps to the empty object position,the problem here is that the empty object position will change so the distance from the cube to te empty object will be different,in this case i need to change the time that it takes the animation to complete,so it does not play and after that let the cube move just in a straight line…I want the animation to take a longer or shorter time to run,giving that the empty object position will always change…

Depends what you mean by run longer. If it’s playback speed, then you’re after the Animator Controller that is playing the animation for that gameobject.
Once you have that, it is a simple case of setting the playback speed.

public Animator myAnimator;

void Start()
{
      //if you haven't assigned one, grab the one on this object
      if(myAnimator == null)
      {
            myAnimator = GetComponent<Animator>();
      }
}

void UpdateSpeed(float speed)
{
      myAnimator.speed = speed;
}

//this would allow you to specify how long you want the animation to play for, not essential but may prove useful. This should allow the speed to be setup so that the animation will end in playTime seconds
void SetSpeed(float animationLength , float playTime)
{
      //speed is a ratio between the actual clip length, and how long you want it to play for. 
      float speed = animationLength / playTime;

      myAnimator.speed = speed;
}

How you transition in and out of your jump animation is up to you. Don’t forget to check the Animator reference docs, may help if speed isn’t what you’re after. Don’t forget to experiment with different things. Also, don’t forget to reset the speed when you’re finished with it. The playback speed controls the speed of the Animator component, which will affect any animation inside the assigned controller.

Hopefully this helps.