Struct 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 with min_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: f32

Implementations§

Source§

impl WindMouse

Source

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

Source

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.0
  • gravity: 9.0
  • wind: 3.0
  • min_wait: 2.0
  • max_wait: 10.0
  • max_step: 10.0
  • target_area: 100.0
Source

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

Trait Implementations§

Source§

impl Debug for WindMouse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V