Will only 22 blocks of code, I've made a program to detect the speed of the mouse pointer. The number is in pixels per second, by the way.
I've used a similar method in this fidget spinner project I made a while ago: https://scratch.mit.edu/projects/446437830/