Fix cursor animation being stuck for 1 frame after animation reset

macos-click-through
Jon Valdés 5 years ago
parent 6939a8186b
commit 6d2d398c23

@ -225,7 +225,7 @@ impl CursorVfx for ParticleTrail {
TrailMode::Torpedo => rng.rand_dir() * 10.0, TrailMode::Torpedo => rng.rand_dir() * 10.0,
TrailMode::PixieDust => { TrailMode::PixieDust => {
let base_dir = rng.rand_dir(); let base_dir = rng.rand_dir();
let dir = Point::new(base_dir.x * 0.5, base_dir.y.abs()); let dir = Point::new(base_dir.x * 0.5, 0.4 + base_dir.y.abs());
dir * 30.0 dir * 30.0
} }
}; };

@ -28,7 +28,7 @@ pub struct CursorSettings {
pub fn initialize_settings() { pub fn initialize_settings() {
SETTINGS.set(&CursorSettings { SETTINGS.set(&CursorSettings {
animation_length: 0.1, animation_length: 0.13,
vfx_mode: cursor_vfx::VfxMode::Disabled, vfx_mode: cursor_vfx::VfxMode::Disabled,
}); });
@ -179,8 +179,6 @@ impl Corner {
let direction_alignment = travel_direction.dot(corner_direction); let direction_alignment = travel_direction.dot(corner_direction);
self.current_position =
ease_point(ease_out_expo, self.start_position, corner_destination, self.t);
if self.t == 1.0 { if self.t == 1.0 {
// We are at destination, move t out of 0-1 range to stop the animation // We are at destination, move t out of 0-1 range to stop the animation
@ -189,6 +187,9 @@ impl Corner {
let corner_dt = dt * lerp(1.0, 1.0 - CURSOR_TRAIL_SIZE, -direction_alignment); let corner_dt = dt * lerp(1.0, 1.0 - CURSOR_TRAIL_SIZE, -direction_alignment);
self.t = (self.t + corner_dt / settings.animation_length).min(1.0) self.t = (self.t + corner_dt / settings.animation_length).min(1.0)
} }
self.current_position =
ease_point(ease_out_expo, self.start_position, corner_destination, self.t);
true true
} }

Loading…
Cancel
Save