Skip to content

Commit

Permalink
configurable enter and leave transition easing curves; fix: #186
Browse files Browse the repository at this point in the history
  • Loading branch information
mseemann committed Nov 8, 2016
1 parent a644411 commit f119cc7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,32 @@ <h5>Dialog configuration object</h5>
</tr>

<tr>
<td>enterTransitionDuration?: number;</td>
<td>enterTransitionDuration?: number</td>
<td>
Alter the the transition duration for the enter animation in ms. Defaults to 300ms.
</td>
</tr>

<tr>
<td>leaveTransitionDuration?: number;</td>
<td>enterTransitionEasingCurve?: string</td>
<td>
The easing curve for the enter animation. defaults to cubic-bezier(0.0, 0.0, 0.2, 1)
</td>
</tr>

<tr>
<td>leaveTransitionDuration?: number</td>
<td>
Alter the the transition duration for the leave animation in ms. Defaults to 250ms.
</td>
</tr>

<tr>
<td>leaveTransitionEasingCurve?: string</td>
<td>
The easing curve for the leave animation. defaults to cubic-bezier(0.0, 0.0, 0.2, 1)
</td>
</tr>

</tbody>
</table>
10 changes: 10 additions & 0 deletions src/lib/components/dialog/mdl-dialog-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,20 @@ export interface IMdlDialogConfiguration {
*/
enterTransitionDuration?: number;

/**
* The easing curve for the enter animation. defaults to cubic-bezier(0.0, 0.0, 0.2, 1)
*/
enterTransitionEasingCurve?: string;

/**
* The curation for the leave animation in ms. defaults to 250ms
*/
leaveTransitionDuration?: number;

/**
* The easing curve for the leave animation. defaults to cubic-bezier(0.0, 0.0, 0.2, 1)
*/
leaveTransitionEasingCurve?: string;
}

/**
Expand Down
11 changes: 9 additions & 2 deletions src/lib/components/dialog/mdl-dialog-host.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import { InternalMdlDialogReference } from './internal-dialog-reference';
const enterTransitionDuration = 300;
const leaveTransitionDuration = 250;

const enterTransitionEasingCurve = 'cubic-bezier(0.0, 0.0, 0.2, 1)';
const leaveTransitionEasingCurve = 'cubic-bezier(0.0, 0.0, 0.2, 1)';

// helper defintions - these classes are private in angular
// but render.animate is public and uses theese defintions

Expand Down Expand Up @@ -176,7 +179,9 @@ export class MdlDialogHostComponent implements OnInit {
{offset:0, styles: { styles: [this.showAnimationStartStyle]}},
{offset:1, styles: { styles: [this.showStyle]}}
],
this.config.enterTransitionDuration || enterTransitionDuration, 0, 'cubic-bezier(0.0, 0.0, 0.2, 1)');
this.config.enterTransitionDuration || enterTransitionDuration,
0,
this.config.enterTransitionEasingCurve || enterTransitionEasingCurve);

animation.onDone( () => {
this.ngZone.run( () => {
Expand All @@ -200,7 +205,9 @@ export class MdlDialogHostComponent implements OnInit {
{offset:0, styles: { styles: [this.showStyle]}},
{offset:1, styles: { styles: [this.hideAnimationEndStyle]}}
],
this.config.leaveTransitionDuration || leaveTransitionDuration, 0, 'cubic-bezier(0.0, 0.0, 0.2, 1)');
this.config.leaveTransitionDuration || leaveTransitionDuration,
0,
this.config.leaveTransitionEasingCurve || leaveTransitionEasingCurve);

animation.onDone( () => {
this.ngZone.run( () => {
Expand Down

0 comments on commit f119cc7

Please sign in to comment.