Open cvan opened 9 years ago
Will discuss with @kearwood this week in Vancouver to better understand what might be causing the gliches and identify potential work arounds. Two issues with above are:
1) Longer term we aspire to create richer animations, wherein multiple elements simultaneously animate values like position, scale, opacity, etc. It's smart to identify a work around to glitches with today's builds, but we should not stop there. 2) HUD actually consists of multiple elements with independent visibility. eg Loading indicator and stop/reload button persist even when other HUD elements are closed. So we need something more granular than visibility on #hud.
problem
currently, there is (1) a flicker when the HUD is closed as Horizon loads for the first time and (2) jank when the HUD is opened/closed.
diagnosis
in showing the HUD and hiding the HUD, we're doing a bunch of writes, which by nature cause layout reflows. I'd wager money that we'd see reduced jank if we animated on one element (
#hud
) and used a class to toggle visibility.transitions vs. animations
I can't speak on which is more performant under the hood (though I'm curious which is more optimised under the hood), but from a code-maintenance perspective, transitioning on
visibility
would be easier than setting theseshow
andhide
animations.proposed solution
#hud
) so we don't need to explicitly callFrameManager.hideHud()
when Horizon loads.#hud
), instead of a bunch of child elements.classList.toggle
to toggle the visibility class (instead of directly callingstyle
) on the animated/transitioned element.