Struct windmouse_rs::WindMouse
source · pub struct WindMouse {
pub gravity: f32,
pub wind: f32,
pub min_wait: f32,
pub max_wait: f32,
pub max_step: f32,
pub target_area: f32,
pub mouse_speed: f32,
pub random_speed: f32,
}Expand description
WindMouse struct containing parameters for the mouse movement algorithm
This struct holds all the parameters that influence the behavior of the WindMouse algorithm, allowing for fine-tuning of the generated mouse movements.
§Parameters
-
gravity: Influences how strongly the mouse is pulled towards the target. Higher values make the movement more direct. -
wind: Determines the amount of randomness in the mouse’s path. Higher values create more curved and unpredictable movements. -
min_wait: The minimum time (in milliseconds) to wait between mouse movements. This helps simulate human-like pauses in movement. -
max_wait: The maximum time (in milliseconds) to wait between mouse movements. Along withmin_wait, this creates variability in movement speed. -
max_step: The maximum distance the mouse can move in a single step. This prevents unrealistically fast movements. -
target_area: The distance from the end point at which the algorithm starts to slow down and become more precise. -
mouse_speed: A general speed factor for the mouse movement. Higher values result in faster overall movement. -
random_speed: An additional randomness factor for mouse speed. This helps create more natural, variable-speed movements.
Fields§
§gravity: f32§wind: f32§min_wait: f32§max_wait: f32§max_step: f32§target_area: f32§mouse_speed: f32§random_speed: f32Implementations§
source§impl WindMouse
impl WindMouse
sourcepub fn new(
mouse_speed: f32,
gravity: f32,
wind: f32,
min_wait: f32,
max_wait: f32,
max_step: f32,
target_area: f32,
) -> Result<Self, WindMouseError>
pub fn new( mouse_speed: f32, gravity: f32, wind: f32, min_wait: f32, max_wait: f32, max_step: f32, target_area: f32, ) -> Result<Self, WindMouseError>
Creates a new WindMouse instance with the specified parameters
sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Creates a new WindMouse instance with default values for all parameters except target_area
This function provides a convenient way to create a WindMouse instance with sensible defaults for most parameters.
§Arguments
target_area- The distance from the end point at which the algorithm starts to slow down
§Default values
mouse_speed: 10.0gravity: 9.0wind: 3.0min_wait: 2.0max_wait: 10.0max_step: 10.0target_area: 100.0
sourcepub fn generate_points(
&self,
start: Coordinate,
end: Coordinate,
) -> Vec<[i32; 3]>
pub fn generate_points( &self, start: Coordinate, end: Coordinate, ) -> Vec<[i32; 3]>
Generates a series of points representing the mouse movement path from the start coordinate to the end coordinate