feat: add fadein fadeout curve

This commit is contained in:
DreamMaoMao
2025-12-12 11:08:53 +08:00
parent ddc2448d1c
commit 91f4604199
7 changed files with 92 additions and 12 deletions

View File

@@ -630,6 +630,7 @@ void fadeout_client_animation_next_tick(Client *c) {
int type = c->animation.action = c->animation.action;
double factor = find_animation_curve_at(animation_passed, type);
uint32_t width = c->animation.initial.width +
(c->current.width - c->animation.initial.width) * factor;
uint32_t height =
@@ -650,7 +651,13 @@ void fadeout_client_animation_next_tick(Client *c) {
.height = height,
};
double opacity = MAX(fadeout_begin_opacity - animation_passed, 0);
double opacity_eased_progress =
find_animation_curve_at(animation_passed, OPAFADEOUT);
double percent = fadeout_begin_opacity -
(opacity_eased_progress * fadeout_begin_opacity);
double opacity = MAX(percent, 0);
if (animation_fade_out && !c->nofadeout)
wlr_scene_node_for_each_buffer(&c->scene->node,
@@ -1109,8 +1116,11 @@ bool client_apply_focus_opacity(Client *c) {
? (double)passed_time / (double)c->animation.duration
: 1.0;
double opacity_eased_progress =
find_animation_curve_at(linear_progress, OPAFADEIN);
float percent =
animation_fade_in && !c->nofadein ? linear_progress : 1.0;
animation_fade_in && !c->nofadein ? opacity_eased_progress : 1.0;
float opacity =
c == selmon->sel ? c->focused_opacity : c->unfocused_opacity;