-
I have this simple <script type="module">
import 'https://esm.run/@material/[email protected]/all.js'
</script>
<md-outlined-button class="btn">Back</md-outlined-button>
<md-dialog class="da" fade>
<div slot="headline">
Dialog title
</div>
<form slot="content" id="form-id" method="dialog">
A simple dialog with free-form content.
</form>
<div slot="actions">
<md-text-button form="form-id">Ok</md-text-button>
</div>
</md-dialog> |
Beta Was this translation helpful? Give feedback.
Answered by
asyncLiz
Apr 12, 2024
Replies: 1 comment 3 replies
-
You can customize the transition by overriding those functions and returning your own animation keyframes to change any aspect of the animations. There's a default open/close animation object that you can reference for the options available. Each part of the dialog (like the dialog itself, the scrim, or the content) can be given one or more animations, represented as an array of const dialog = document.querySelector('md-dialog');
dialog.getOpenAnimation = () => {
// A simpler and faster fade-in animation
return {
// An array of one or more animations
dialog: [
// A single simple fade-in animation
[
// args for Element.animate(keyframes, options);
[{'opacity': '0'}, {'opacity': '1'}],
{duration: 250, easing: 'ease-in-out'},
]
],
scrim: [
// Same fade-in for the scrim
[
[{'opacity': '0'}, {'opacity': '0.32'}],
{duration: 250, easing: 'ease-in-out'},
]
],
};
}; |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
asyncLiz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can customize the transition by overriding those functions and returning your own animation keyframes to change any aspect of the animations.
There's a default open/close animation object that you can reference for the options available.
Each part of the dialog (like the dialog itself, the scrim, or the content) can be given one or more animations, represented as an array of
Element.animate()
arguments.