Skip to content

Commit 2ca5cff

Browse files
committed
slow down animations
1 parent 53e5b77 commit 2ca5cff

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/wlr_layout_ui/displaywidget.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from .utils import Rect, brighten
99
from .widgets import Widget
1010

11+
ANIMATION_LENGTH = 10
12+
1113

1214
class GuiScreen(Widget):
1315
def __repr__(self):
@@ -76,10 +78,11 @@ def _animation_step(self):
7678
if abs(tv - cv) <= 1:
7779
setattr(r, var, tv)
7880
else:
81+
target = cv * ANIMATION_LENGTH + tv
7982
if cv < tv:
80-
setattr(r, var, min(tv, (cv + tv) / 2))
83+
setattr(r, var, min(tv, target / ANIMATION_LENGTH + 1))
8184
elif cv > tv:
82-
setattr(r, var, max(tv, (cv + tv) / 2))
85+
setattr(r, var, max(tv, target / ANIMATION_LENGTH + 1))
8386

8487
def set_position(self, x, y):
8588
self.rect.x = x

0 commit comments

Comments
 (0)