Skip to content

Commit

Permalink
fix(menu): wrong animation in Angular 4.2+ (#5836)
Browse files Browse the repository at this point in the history
Fixes the new menu animation glitching out against Angular 4.2. It seems like transitioning from `scale(0, 0)` to `scale(1, 0.5)` works correctly at the moment. This is a workaround that will transition it from `scale(0.01, 0.01)` instead.
  • Loading branch information
crisbeto authored and andrewseguin committed Jul 25, 2017
1 parent 9a90eaf commit 39c3e42
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/menu/menu-animations.ts
Expand Up @@ -17,7 +17,8 @@ import{

/**
* Below are all the animations for the md-menu component.
* Animation duration and timing values are based on AngularJS Material.
* Animation duration and timing values are based on:
* https://material.io/guidelines/components/menus.html#menus-usage
*/


Expand All @@ -34,11 +35,13 @@ import{
export const transformMenu: AnimationTriggerMetadata = trigger('transformMenu', [
state('void', style({
opacity: 0,
transform: 'scale(0, 0)'
// This starts off from 0.01, instead of 0, because there's an issue in the Angular animations
// as of 4.2, which causes the animation to be skipped if it starts from 0.
transform: 'scale(0.01, 0.01)'
})),
state('enter-start', style({
opacity: 1,
transform: `scale(1, 0.5)`
transform: 'scale(1, 0.5)'
})),
state('enter', style({
transform: 'scale(1, 1)'
Expand All @@ -57,6 +60,6 @@ export const fadeInItems: AnimationTriggerMetadata = trigger('fadeInItems', [
state('showing', style({opacity: 1})),
transition('void => *', [
style({opacity: 0}),
animate(`400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)`)
animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')
])
]);

0 comments on commit 39c3e42

Please sign in to comment.