After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737017 - iconGrid: Use dynamic max delay for pulse animations
iconGrid: Use dynamic max delay for pulse animations
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2014-09-20 10:56 UTC by Carlos Soriano
Modified: 2014-10-09 11:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
iconGrid: Use dynamic max delay for pulse animations (1.89 KB, patch)
2014-09-20 10:56 UTC, Carlos Soriano
accepted-commit_after_freeze Details | Review
iconGrid: Fix slowness on pulse animation for few items (1.83 KB, patch)
2014-09-20 20:32 UTC, Carlos Soriano
reviewed Details | Review
iconGrid: Fix slowness on pulse animation for few items (2.07 KB, patch)
2014-10-09 09:06 UTC, Carlos Soriano
committed Details | Review

Description Carlos Soriano 2014-09-20 10:56:12 UTC
This will fix the slowness on pulse animation when there are only a few
items.
Comment 1 Carlos Soriano 2014-09-20 10:56:16 UTC
Created attachment 286683 [details] [review]
iconGrid: Use dynamic max delay for pulse animations

Currently animations delay for pulse animation are calculated based on
the number of actors. That bring a problem though, when there are only a
few actors the animations feels very slow.
To avoid that make the delay of the animation dynamic for the first
items and then use a maximum value on.
Comment 2 Florian Müllner 2014-09-20 13:13:10 UTC
Review of attachment 286683 [details] [review]:

"To avoid that make the delay of the animation dynamic for the first items"

This is misleading:
 - the behavior is not different for the first items, but for small (total) number of items
 - it's not really dynamic: if the number of items is <= 4, you use a constant delay of 1/6 ANIMATION_TIME_IN

I do wonder whether it makes sense to just always pick a fixed delay - it means that the total length of the folder animation depends on the number of items in the folder, but that doesn't sound too crazy ...

::: js/ui/iconGrid.js
@@ +431,3 @@
         }
 
+        let totalDelay = clamp(ANIMATION_BASE_DELAY_FOR_ITEM * actors.length, 0, ANIMATION_MAX_DELAY_FOR_ITEM);

Why clamp? Math.min(ANIMATION_BASE-DELAY_FOR_ITEM * actors.length, ANIMATION_MAX_DELAY_FOR_ITEM) can never be negative ...
Comment 3 Carlos Soriano 2014-09-20 19:51:02 UTC
(In reply to comment #2)
> Review of attachment 286683 [details] [review]:
> 
> "To avoid that make the delay of the animation dynamic for the first items"
> 
> This is misleading:
>  - the behavior is not different for the first items, but for small (total)
> number of items
>  - it's not really dynamic: if the number of items is <= 4, you use a constant
> delay of 1/6 ANIMATION_TIME_IN
You are right.
I made some different codes, and this was my last one, and it's not dynamic.
> 
> I do wonder whether it makes sense to just always pick a fixed delay - it means
> that the total length of the folder animation depends on the number of items in
> the folder, but that doesn't sound too crazy ...
we can't control how much items are in the folder, so it can be really slow for lot of items. So it's not really scalable.
> 
> ::: js/ui/iconGrid.js
> @@ +431,3 @@
>          }
> 
> +        let totalDelay = clamp(ANIMATION_BASE_DELAY_FOR_ITEM * actors.length,
> 0, ANIMATION_MAX_DELAY_FOR_ITEM);
> 
> Why clamp? Math.min(ANIMATION_BASE-DELAY_FOR_ITEM * actors.length,
> ANIMATION_MAX_DELAY_FOR_ITEM) can never be negative ...
Right.
Comment 4 Carlos Soriano 2014-09-20 20:32:31 UTC
Created attachment 286704 [details] [review]
iconGrid: Fix slowness on pulse animation for few items

Currently we use the same amount of total delay divided by all items,
but that makes the items animate slow if the amount of items is small.
To avoid that, use a smaller total amount delay for an amount of items
smaller than four.
Comment 5 Florian Müllner 2014-09-20 21:30:27 UTC
Review of attachment 286704 [details] [review]:

(In reply to comment #3)
> we can't control how much items are in the folder, so it can be really slow for
> lot of items. So it's not really scalable.

But does it matter? With a delay of roughly 60ms (e.g. what you are using in this patch for up to 4 items), 18 items will take about a second (which admittedly is 200-300ms longer than the current animation) - assuming a 6x4 grid, those would be all items actually visible without scrolling, so not sure anything above that matters too much ...

That said, I'm perfectly fine with this approach, just some nits that escaped me earlier:

::: js/ui/iconGrid.js
@@ +431,3 @@
         }
 
+        let totalDelay = Math.min(ANIMATION_BASE_DELAY_FOR_ITEM * actors.length, ANIMATION_MAX_DELAY_FOR_ITEM);

"totalDelay" sounds like

   ANIMATION_MAX_DELAY_FOR_ITEM * (actors.length - 1) / 2

to me, e.g. the sum of all delays added together. Should use something like maxDelay (though that's slightly incorrect as well, as the largest delay used will be slightly smaller than that, but meh).

It's also not immediately obvious without the context of this bug, so a small comment would be good.
Comment 6 Carlos Soriano 2014-10-09 09:06:49 UTC
Created attachment 288102 [details] [review]
iconGrid: Fix slowness on pulse animation for few items

Currently we use the same amount of total delay divided by all items,
but that makes the items animate slow if the amount of items is small.
To avoid that, use a smaller total amount delay for an amount of items
smaller than four.
Comment 7 Carlos Soriano 2014-10-09 09:07:46 UTC
(In reply to comment #6)
> Created an attachment (id=288102) [details] [review]
> iconGrid: Fix slowness on pulse animation for few items
> 
> Currently we use the same amount of total delay divided by all items,
> but that makes the items animate slow if the amount of items is small.
> To avoid that, use a smaller total amount delay for an amount of items
> smaller than four.

I want review on the comment, I'm not sure how good it is =)
Comment 8 Florian Müllner 2014-10-09 10:17:49 UTC
Review of attachment 288102 [details] [review]:

Comment looks fine to me
Comment 9 Carlos Soriano 2014-10-09 10:48:01 UTC
Comment on attachment 288102 [details] [review]
iconGrid: Fix slowness on pulse animation for few items

Thanks for review!

Attachment 288102 [details] pushed as d0de411 - iconGrid: Fix slowness on pulse animation for few items