need code for two motors speed controlling using one throttle and one i/p sensor

need a code to control two motors speed using one potentiometer in a way by which

if I rotate potentiometer, at same time, one motor should increase speed and other should decrease speed and vice versa.

im using a 5V motor and potentiometer.

or can give a code similar to the above

i have two hub motors and one throttle and one sensor, need a code by which sensor should vary throttle voltage to each individual hub motor.

ex: throttle and hub motor input voltages - both 0-5v for speed controlling. sensor value -90 to 90.

so at 0 sensor value, two motors should receive equal voltages from the throttle.

at -90, one motor should have full speed and other should stop and vice versa for plus 90 and should vary in a linear way from -90 to 90.

read the pot
use map to limit its value to -90 - 90
the abs() is the PWM
determine the sign which is the direction of one motor and the opposite sign the direction of the other

     0   90 -1  1
    128   68 -1  1
    256   45 -1  1
    384   23 -1  1
    512    0  1 -1
    640   22  1 -1
    768   45  1 -1
    896   67  1 -1
   1024   90  1 -1
void range (
    int   x)
{
    int val = map (x, 0,1023, -90, 90);

    int  dirA = val / abs(val);
    int  dirB = - dirA;
    val       = abs(val);

    char s [80];
    sprintf (s, " %6d %4d %2d %2d", x, val, dirA, dirB);
    Serial.println (s);
}

// -----------------------------------------------------------------------------
void loop()
{
 // int pot = analogRead (A0);

    delay (200);
}

// -----------------------------------------------------------------------------
void setup()
{
    Serial.begin(115200);

    for (int x = 0; x <= 1024; x += 128)
        range (x);
}

The OP did not mention running the motors in both direction. They want one motor it increase in speed as the other decreases.

read pot: 0-1023
convert to PWM range: 0-255

Motor A get PWM value
Motor B get 255 - PWM value