Please help, how to set the speed of an animation

Ok, I think the solution to my problem is a simple one, so if someone could help me out and stop me from going mad…
All I need to do is to set an animation speed on the player object, relative to the movement of another object(i.e a sphere)
So as soon as the sphere starts moving the player animation starts, but at a slow speed, but can increase when the sphere moves faster. And likewise for slowing, the player animation slows, until the sphere has stopped.

I have 1 script on the sphere -

public static float speed = 300;

private Vector3 tilt = Vector3.zero;
private float circ;

void FixedUpdate () 
{
	
	circ = 2 * Mathf.PI * collider.bounds.extents.x;
	
	tilt.x = -Input.acceleration.y + Input.GetAxis ("Horizontal");
	tilt.z = Input.acceleration.x + Input.GetAxis ("Vertical");
	
	rigidbody.AddForce(tilt * speed * Time.deltaTime);
}

}

and other on the player. And this is where my animation script will be. So I only want 1 animation at the moment (walking) with the speed of walking to be relative to the movement of the sphere.

Thats it, so please if anyone can help, or to put me in the right direction, I’d appreciate it bigtime!
Thanks…

Use AnimationState.speed.

var sphere : Transform;

function Update () {    
    if(!animation.isPlaying)
        animation.Play("Walk");
 
    animation["Walk"].speed = sphere.rigidbody.velocity.magnitude;
}

–David–