Change slider value based off of relative mouse movement

Hi. I want to use a UI slider but I want its value to change based on relative mouse movement, not absolute mouse movement. I want it to move without the user having to click and drag the knob. I want the user to be able to click anywhere and have the value change based off of relative mouse movement. So the faster the user clicks and drags the faster the value will change and the slower the user clicks and drags the slower the value will change. I know I can change the slider’s value by doing MySlider.value but I am not sure of the correct math to change the value based on how slow/fast the user clicks and drags. Any and all help is appreciated.

save the position when clicked to a variable and start measuring the current mouse position from the clicked position. Something like: vector3.distance

If you’re looking to accelerate the mouse movement to something different skip the math and check out implementing an animation curve. Then map the mouse movement to your knob along the animation curve.