Has anyone done a nice, smooth transition from visible and invisible, particularly for component panels?
Asking on the off chance someone has, so I don’t have to …
Has anyone done a nice, smooth transition from visible and invisible, particularly for component panels?
Asking on the off chance someone has, so I don’t have to …
A component becomes invisible by acquiring the visible-false
CSS class. You could absolutely use CSS transitions to handle this. You’d need to be a bit clever - the CSS display
property doesn’t accept transitions, so you’d want to override the display: none
in the standard Anvil CSS, and then use some other way to hide your component (height: 0; overflow: hidden;
is quite popular).
It can definitely be done, though!
Hi David,
What do you think about how this looks?
Basically, it works as follows:
/* Al hack transition out */
.anvil-role-transition_out {
opacity: 1;
transition: opacity 1s ease-out;
-moz-transition: opacity 1s ease-out;
-webkit-transition: opacity 1s ease-out;
}
.anvil-role-transition_out:focus {
opacity: 0;
}
time.sleep()
to allow time for the transition, prior to setting visibility to False
Here’s the clone:
https://anvil.works/build#clone:QEJVPDVPC5KT2IFB=LX6ITGGU2WGPVYNP5GSLVW6Y
I’m not sure if this is what you were looking for but nevertheless I thought I’d have a crack at it.
Cheers for that.
But I don’t get how it works. I can’t see those roles assigned anywhere?
I must’ve deleted the role for the sake of renaming it, and forgotten to add it back; however, the role must’ve been operating somehow despite not being there. How odd. I’ve added the role entry to the clone now.
A couple of roles were blank rather than “<default>”, which I think were the offending ones.
Did you change their name or something? Might be a subtle bug there I think …
During my testing I had renamed some roles, and then set/reset the components’ role designation in the designer. Odd that they would show blank instead of “<default>”. Perhaps if you set a component’s role, and then delete the role in the Role page, the component is set to blank instead of “<default>”.
The app does function as expected though correct?
Yes, that’s what was puzzling me. And when I inspected the elements in the browser they had the appropriate anvil-role-xxx class in them. I just couldn’t see how!
Okay cool. Yes, a subtle bug indeed.