BottomSheet: improve hero animation
This commit is contained in:
parent
70649e97e6
commit
bcfb846115
5 changed files with 11 additions and 9 deletions
|
@ -62,12 +62,14 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
|||
});
|
||||
|
||||
const onClose = () => {
|
||||
hero()!.style.visibility = 'unset'
|
||||
element.close();
|
||||
setHero();
|
||||
};
|
||||
|
||||
const animatedClose = () => {
|
||||
const endRect = hero();
|
||||
const srcElement = hero()
|
||||
const endRect = srcElement?.getBoundingClientRect();
|
||||
if (endRect) {
|
||||
const startRect = element.getBoundingClientRect();
|
||||
const animation = animateHero(startRect, endRect, element, true);
|
||||
|
@ -81,8 +83,10 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
|||
|
||||
const animatedOpen = () => {
|
||||
element.showModal();
|
||||
const startRect = hero();
|
||||
const srcElement = hero()
|
||||
const startRect = srcElement?.getBoundingClientRect();
|
||||
if (!startRect) return;
|
||||
srcElement!.style.visibility = 'hidden'
|
||||
const endRect = element.getBoundingClientRect();
|
||||
animateHero(startRect, endRect, element);
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ const Img: Component<ImgProps> = (props) => {
|
|||
object-position: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
visibility: ${isBlurEnabled() ? "hidden" : "visible"};
|
||||
visibility: ${isBlurEnabled() ? "hidden" : "initial"};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue