UNDERSTANDING HOW POT CONTROLS THE 5V DIRECT CONNECTION

The code is below;
The transistor is fed directly from the 5v and gnd rails.
The POT is fed likewise and the center rail links to analog 0.
How does the POT intervene with the direct 5v supply and reduce it?
The book doesn't explain the interactions.
Thanks!

/
int potPin = A0;
int motorPin = 9;

int potValue = 0;
int motorValue = 0;

void setup() {
Serial.begin(9699);

}

void loop() {
potValue = analogRead(potPin);
motorValue = map(potValue,0,1023,0,255);

analogWrite(motorPin, motorValue);

Serial.print("potentiometer = ");
Serial.print(potValue);
Serial.print("\t motor = ");
Serial.println(motorValue);
delay(2);

}

/

The potentiometer is a variable voltage divider.

Where’s the schematic?
It sounds like you have the transistor directly across 5V and Gnd...?
What happens when the transistor turns on?

you did google potentiometer?

read the bottom part of my signature