Here is a modified example from the varSpeedServo library that changes the speed in accorcance with a potentiometer setting. Pot connected to pin A0, servo to pin 9. Note that the wait function blocks.
#include <VarSpeedServo.h>
// create servo object to control a servo
VarSpeedServo myservo1;
void setup()
{
// initialize serial:
Serial.begin(9600);
myservo1.attach(9);
}
void loop()
{
int LEF = 0;
int RIG = 180;
//int SPEED1 = 160;
int SPEED1 = analogRead(A0) / 4;
myservo1.write(LEF, SPEED1);
myservo1.wait();
SPEED1 = analogRead(A0) / 4;
myservo1.write(RIG, SPEED1);
myservo1.wait();
}