Search Issue Tracker
By Design
Votes
0
Found in [Package]
Built-in
Issue ID
1365085
Regression
No
UI Builder Background Color Transition Animation doesn't start from 0 Opacity when no Background Color is set
How to reproduce:
1. Open the user's attached project
2. In the Project view, open Assets/UI/BugBackgroundColorTransition/BugBackgroundColorTransition.uxml (double-click the Asset)
3. In the UI Builder window, under the Hierarchy section, expand the "#Root" element to show the Child "#BuggyElement"
4. From the StyleSheets section, select ".whiteBackground" and drag it onto the "#BuggyElement" in the Hierarchy
5. Observe the Transition Animation in the Viewport
Expected result: the Transition starts from full transparency
Actual result: the Transition doesn't start from full transparency; at the start of the Animation, the background color is visibly darker
Reproducible with: built-in (2021.2.0b12, 2022.1.0a9)
Could not test with: 1.0.0-preview.17 (2019.4.30f1, 2020.3.19f1, 2021.1.22f1) (Transition Animations are not supported in the Package)
-
Midiphony-panda
Oct 25, 2021 16:36
In previous beta versions, the transition went from opaque black to opaque white, when the default state was "transparent black". The immediate switch from "transparent black" to opaque black was not seamless at all.
In newer beta versions, it indeed goes from transparent black to opaque white.
For specific cases where we want to blend from a specific "transparent color", we should indeed add a specific selector.
Thanks !
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Hover style remains on elements after the cursor is moved away when the 'transition-delay' property is used
- [Android] [UIToolkit] FPS drops/increase in time consumption in the UI Toolkit rendering when adding "style.backgroundColor" and/or "style.backgroundImage" to the VisualElement
- onDisable not always called for SearchProvider
- Build failure errors are cleared in console before you can read them
- Sprite Library Editor contains corrupted and low resolution icons
Resolution Note:
Looking at the repro project from the bug report, I believe it is doing what it's supposed to do.
When the background color is not set at all on the element, it will be resolved as rgba(0, 0, 0, 0), so transparent black. So in this case, the transition will go from transparent black to opaque white, so as the alpha is getting from 0 to 1, so will the actual color, giving the darker to lighter transition. If they want only the opacity to transition, they will need to have a selector setting the "default" color to rgba(255, 255, 255, 0).
Note also that when using the rgba function, the alpha should be clamped between 0 and 1.
An alternative way to achieve this is to set the color as white from the get go and to transition using the style.opacity property.