ui: add profile picture hover animation

I wanted to practice doing animation in egui, so here is a simple
profile picture hover affect. When you mouse over a profile picture, it
get slightly bigger.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-23 18:20:20 -07:00
parent 61deeb03e1
commit e8168b0004
6 changed files with 69 additions and 4 deletions

View File

@@ -16,10 +16,14 @@ impl<'cache, 'url> egui::Widget for ProfilePic<'cache, 'url> {
impl<'cache, 'url> ProfilePic<'cache, 'url> {
pub fn new(cache: &'cache mut ImageCache, url: &'url str) -> Self {
let size = 32.0;
let size = Self::default_size();
ProfilePic { cache, url, size }
}
pub fn default_size() -> f32 {
32.0
}
pub fn no_pfp_url() -> &'static str {
"https://damus.io/img/no-profile.svg"
}