mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-20 06:59:50 -05:00
opt: optimize fade in animaiton
This commit is contained in:
parent
4e02e81ad9
commit
565a77ad3a
1 changed files with 9 additions and 8 deletions
|
|
@ -961,15 +961,16 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
client_set_opacity(c, 1);
|
||||
} else if (c->animation.running && c->animation.action == OPEN) {
|
||||
c->opacity_animation.running = false;
|
||||
float percent =
|
||||
animation_fade_in && !c->nofadein
|
||||
? (double)c->animation.passed_frames / c->animation.total_frames
|
||||
: 1.0;
|
||||
float opacity = c->isfullscreen ? 1
|
||||
: c == selmon->sel ? c->focused_opacity
|
||||
: c->unfocused_opacity;
|
||||
float linear_progress =
|
||||
(float)c->animation.passed_frames / c->animation.total_frames;
|
||||
|
||||
float target_opacity = percent + fadein_begin_opacity;
|
||||
float percent =
|
||||
animation_fade_in && !c->nofadein ? linear_progress : 1.0;
|
||||
float opacity =
|
||||
c == selmon->sel ? c->focused_opacity : c->unfocused_opacity;
|
||||
|
||||
float target_opacity =
|
||||
percent * (1.0 - fadein_begin_opacity) + fadein_begin_opacity;
|
||||
if (target_opacity > opacity) {
|
||||
target_opacity = opacity;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue