nolanlawson / pinafore

Alternative web client for Mastodon (UNMAINTAINED)
https://pinafore.social
GNU Affero General Public License v3.0
1.02k stars 173 forks source link

fix: fix nav animations #2291

Closed nolanlawson closed 1 year ago

nolanlawson commented 1 year ago

Fixes #2290.

https://user-images.githubusercontent.com/283842/205460527-0c795d55-436b-49c2-8606-b2821ff7cbd7.mp4

My solution was a few things:

  1. Instead of using colors with transparency (which I found impossible to animate correctly due to backgrounds messing with the foreground color), use SASS mix() to achieve basically the same colors. (I eyeballed it, so not super scientific, but it seems close.)
  2. When animating the indicator, mutate the color of the wrapper around (behind) it
  3. Refactor the CSS vars to make the code easier to understand (--nav-indicator-bg, --nav-indicator-bg-active, --nav-indicator-bg-hover).

I tested 3 methods: using the keyboard to change the page, using the mouse on desktop, and simulating touch on a mobile phone. They all look pretty good to me.

FYI @NickColley

NickColley commented 1 year ago

Looking very nice 👍