Skip to content

Commit f6d86e4

Browse files
feat(animation): improve context menu animations
1 parent ec6a40a commit f6d86e4

File tree

13 files changed

+628
-468
lines changed

13 files changed

+628
-468
lines changed

resources/schema.json

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,56 @@
1818
"y": { "$ref": "#/definitions/animated_float_conf" }
1919
}
2020
},
21-
"item": {
22-
"title": "Context Menu Item Animation Configuration",
23-
"description": "Animation effects for context menu items",
24-
"type": "object",
25-
"additionalProperties": false,
26-
"properties": {
27-
"opacity": { "$ref": "#/definitions/animated_float_conf" },
28-
"x": { "$ref": "#/definitions/animated_float_conf" },
29-
"y": { "$ref": "#/definitions/animated_float_conf" },
30-
"width": { "$ref": "#/definitions/animated_float_conf" }
31-
}
32-
},
33-
"bg": {
34-
"title": "Background Animation Configuration",
35-
"description": "Animation effects for context menu background",
21+
"item": {
22+
"title": "Context Menu Item Animation Configuration",
23+
"description": "Animation effects for context menu items",
24+
"type": "object",
25+
"additionalProperties": false,
26+
"properties": {
27+
"opacity": { "$ref": "#/definitions/animated_float_conf" },
28+
"x": { "$ref": "#/definitions/animated_float_conf" },
29+
"y": { "$ref": "#/definitions/animated_float_conf" },
30+
"width": { "$ref": "#/definitions/animated_float_conf" },
31+
"blur": { "$ref": "#/definitions/animated_float_conf" },
32+
"appear_blur": {
33+
"title": "Initial Text Blur",
34+
"description": "Starting blur radius for menu item text appear animation",
35+
"type": "number",
36+
"minimum": 0,
37+
"default": 2.5
38+
}
39+
}
40+
},
41+
"bg": {
42+
"title": "Background Animation Configuration",
43+
"description": "Animation effects for context menu background",
3644
"type": "object",
3745
"additionalProperties": false,
3846
"properties": {
39-
"opacity": { "$ref": "#/definitions/animated_float_conf" },
40-
"x": { "$ref": "#/definitions/animated_float_conf" },
41-
"y": { "$ref": "#/definitions/animated_float_conf" },
42-
"w": { "$ref": "#/definitions/animated_float_conf" },
43-
"h": { "$ref": "#/definitions/animated_float_conf" }
44-
}
45-
}
46-
},
47+
"opacity": { "$ref": "#/definitions/animated_float_conf" },
48+
"x": { "$ref": "#/definitions/animated_float_conf" },
49+
"y": { "$ref": "#/definitions/animated_float_conf" },
50+
"w": { "$ref": "#/definitions/animated_float_conf" },
51+
"h": { "$ref": "#/definitions/animated_float_conf" },
52+
"appear_w_scale": {
53+
"title": "Initial Width Scale",
54+
"description": "Starting width scale for the background expand animation",
55+
"type": "number",
56+
"minimum": 0,
57+
"maximum": 1,
58+
"default": 0.6
59+
},
60+
"appear_h_scale": {
61+
"title": "Initial Height Scale",
62+
"description": "Starting height scale for the background expand animation",
63+
"type": "number",
64+
"minimum": 0,
65+
"maximum": 1,
66+
"default": 0.6
67+
}
68+
}
69+
}
70+
},
4771
"title": "Animation Configuration",
4872
"description": "Configure the animation effects of the context menu",
4973
"type": "object",
@@ -57,12 +81,12 @@
5781
},
5882
"main_bg": {
5983
"$ref": "#/definitions/context_menu/definitions/theme/definitions/animation/definitions/bg"
60-
},
61-
"submenu_bg": {
62-
"$ref": "#/definitions/context_menu/definitions/theme/definitions/animation/definitions/bg"
63-
}
64-
}
65-
}
84+
},
85+
"submenu_bg": {
86+
"$ref": "#/definitions/context_menu/definitions/theme/definitions/animation/definitions/bg"
87+
}
88+
}
89+
}
6690
},
6791
"title": "Context Menu Theme Configuration",
6892
"description": "Configure the theme and appearance of the context menu",

src/shell/config.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,25 @@ struct config {
7272
float acrylic_opacity = 0.1;
7373
bool use_dwm_if_available = true;
7474
bool use_self_drawn_border = true;
75-
struct animation {
76-
struct main {
77-
animated_float_conf y;
78-
} main;
79-
struct item {
80-
animated_float_conf opacity;
81-
animated_float_conf x, y;
82-
animated_float_conf width;
83-
} item;
84-
struct bg {
85-
animated_float_conf opacity;
86-
animated_float_conf x, y, w, h;
87-
} main_bg, submenu_bg;
88-
} animation;
89-
} theme;
75+
struct animation {
76+
struct main {
77+
animated_float_conf y;
78+
} main;
79+
struct item {
80+
animated_float_conf opacity;
81+
animated_float_conf x, y;
82+
animated_float_conf width;
83+
animated_float_conf blur;
84+
float appear_blur = 2.5f;
85+
} item;
86+
struct bg {
87+
animated_float_conf opacity;
88+
animated_float_conf x, y, w, h;
89+
float appear_w_scale = 0.6f;
90+
float appear_h_scale = 0.6f;
91+
} main_bg, submenu_bg;
92+
} animation;
93+
} theme;
9094

9195
bool vsync = true;
9296
bool ignore_owner_draw = true;
@@ -134,4 +138,4 @@ struct config {
134138
static std::filesystem::path data_directory();
135139
void apply_fonts_to_nvg(NVGcontext *nvg);
136140
};
137-
} // namespace mb_shell
141+
} // namespace mb_shell

0 commit comments

Comments
 (0)