Please look over this page for how to add code to the forums. It will display much nicer to view/read
Not sure what “Animator = anim” is supposed to be. That is invalid code.
You could set the Animator:
public Animator anim; // drag the sphere animator here in the inspector
// then, just call it in the if statement:
anim.SetBool("IsMoving", true);
depending on if you took liberties pasting the code here or what not…
your line
Sphere.GetComponent<Animator>();
Could have been :
anim = Sphere.GetComponent<Animator>();
anim.SetBool( // etc
// or ...
Sphere.GetComponent<Animator>().SetBool("IsMoving", true); // like that..