-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(menu): add animations and ripples
Closes #1671
- Loading branch information
Showing
10 changed files
with
222 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import{ | ||
AnimationEntryMetadata, | ||
trigger, | ||
state, | ||
style, | ||
animate, | ||
transition | ||
} from '@angular/core'; | ||
|
||
/** | ||
* Below are all the animations for the md-menu component. | ||
* Animation duration and timing values are based on Material 1. | ||
*/ | ||
|
||
|
||
/** | ||
* This animation controls the menu panel's entry and exit from the page. | ||
* | ||
* When the menu panel is added to the DOM, it scales in and fades in its border. | ||
* | ||
* When the menu panel is removed from the DOM, it simply fades out after a brief | ||
* delay to display the ripple. | ||
*/ | ||
export const transformMenu: AnimationEntryMetadata = trigger('transformMenu', [ | ||
state('showing', style({ | ||
opacity: 1, | ||
transform: `scale(1)` | ||
})), | ||
transition('void => *', [ | ||
style({ | ||
opacity: 0, | ||
transform: `scale(0)` | ||
}), | ||
animate(`200ms cubic-bezier(0.25, 0.8, 0.25, 1)`) | ||
]), | ||
transition('* => void', [ | ||
animate('50ms 100ms linear', style({opacity: 0})) | ||
]) | ||
]); | ||
|
||
/** | ||
* This animation fades in the background color and content of the menu panel | ||
* after its containing element is scaled in. | ||
*/ | ||
export const fadeInItems: AnimationEntryMetadata = trigger('fadeInItems', [ | ||
state('showing', style({opacity: 1})), | ||
transition('void => showing', [ | ||
style({opacity: 0}), | ||
animate(`200ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)`) | ||
]) | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<ng-content></ng-content> | ||
<div class="md-menu-ripple" *ngIf="!disabled" md-ripple md-ripple-background-color="rgba(0,0,0,0)" | ||
[md-ripple-trigger]="_getHostElement()"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<template> | ||
<div class="md-menu-panel" [ngClass]="_classList" | ||
(click)="_emitCloseEvent()" (keydown)="_keyManager.onKeydown($event)"> | ||
<ng-content></ng-content> | ||
<div class="md-menu-panel" [ngClass]="_classList" (keydown)="_keyManager.onKeydown($event)" | ||
(click)="_emitCloseEvent()" [@transformMenu]="'showing'"> | ||
<div class="md-menu-content" [@fadeInItems]="'showing'"> | ||
<ng-content></ng-content> | ||
</div> | ||
</div> | ||
</template> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.