mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 05:44:16 +00:00
small fix for scrolling text with new animation system
This commit is contained in:
parent
e1afb4e257
commit
318fb2809b
1 changed files with 13 additions and 6 deletions
19
src/text.c
19
src/text.c
|
@ -287,14 +287,21 @@ bool text_animate_scroll(struct text* text) {
|
|||
text->scroll,
|
||||
max(text->bounds.size.width, 0));
|
||||
|
||||
g_bar_manager.animator.duration = 1;
|
||||
ANIMATE_FLOAT(text_set_scroll,
|
||||
text,
|
||||
text->scroll,
|
||||
-max(text->width, 0));
|
||||
struct animation* animation = animation_create();
|
||||
float initial_value = text->scroll;
|
||||
float final_value = -max(text->width, 0);
|
||||
|
||||
animation_setup(animation,
|
||||
(void*)text,
|
||||
(bool (*)(void*, int))text_set_scroll,
|
||||
*(int*)&initial_value,
|
||||
*(int*)&final_value,
|
||||
0,
|
||||
INTERP_FUNCTION_LINEAR );
|
||||
animation->as_float = true;
|
||||
animator_add(&g_bar_manager.animator, animation);
|
||||
|
||||
g_bar_manager.animator.duration = text->scroll_duration;
|
||||
|
||||
ANIMATE_FLOAT(text_set_scroll, text, text->scroll, 0);
|
||||
|
||||
g_bar_manager.animator.duration = 0;
|
||||
|
|
Loading…
Reference in a new issue