Does styling opacities conflict with animation opacities?
Randahl Fink Isaksen
randahl at rockit.dk
Wed Aug 29 10:20:37 PDT 2012
We have created our own tool tip control which is a subclass of Pane styled with an opacity of 0.8.
This means our tool tips are just enough transparent that you can vaguely see the content behind it. To make the tool tips look nicer, we decided to animate then, so now when showing the tool tip, we fade it in by gradually changing its opacity from 0.0 to 1.0 using a FadeTransition. So up pops the question: What will the opacity be, once the fade transition ends? Will it be the 0.8 from the CSS, or the 1.0 from the FadeTransition?
From my tests it looks as if the end result is an opacity of 1.0, as if JavaFX follows a last-applied-wins rule – first the CSS opacity is applied, but then the animation comes along and overwrites it.
After having given this some thought, I believe the end result should have been 0.8, mainly because that is the only way to let the work of the developer (who writes the transition) and the UI designer (who writes the CSS) co-exist. If the end result is whatever value is specified in the Transition, the UI designer can no longer fully influence how tool tips look once they have appeared.
Is the 1.0 end result intentional (if so, what is the reasoning behind that decision) or should I perhaps file a bug here?
I am aware that I can easily work around this by using a Pane inside a Pane and have the UI designer style the inner Pane while I animate the outer Pane, but I cannot help thinking, that should not have been necessary.
More information about the openjfx-dev