Is this possible? mouse movement as a condition for a "if condition statement"

Hi. Does anyone know if it is possible to use mouse movement for a condition statement.
something like this.

    if (detectsmousemovement){
            some actions
    }

how do i go about this? any help? thanks