Skip to content

Commit 054737a

Browse files
committed
Updated
1 parent eb944ce commit 054737a

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/pages/home/home.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
</ion-header>
88

99
<ion-content padding [@colorChange]="currentColor">
10-
<button ion-button (click)="changeColor()">Color Change</button>
10+
<button ion-button (click)="changeColor()">Change background color</button>
11+
<button ion-button (click)="changeSize()" [@sizeChange]='currentSize'>Change button size</button>
1112
</ion-content>

src/pages/home/home.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@ import { NavController } from 'ionic-angular';
2525
transition('* => white', animate('3000ms')),
2626
state('pink', style({ background: 'pink' })),
2727
transition('* => pink', animate('3000ms'))
28-
])
28+
]),
29+
trigger('sizeChange', [
30+
state('small', style({
31+
transform: 'scale(1)',
32+
})),
33+
state('large', style({
34+
transform: 'scale(1.2)',
35+
})),
36+
transition('small <=> large', animate('300ms ease-in', style({
37+
transform: 'translateY(40px)'
38+
}))),
39+
]),
2940
],
3041
})
3142
export class HomePage {
@@ -34,11 +45,14 @@ export class HomePage {
3445
private currentColor: string;
3546
colorArr: string[] = ['red', 'green', 'blue', 'yellow', 'orange', 'aqua', 'pink', 'white'];
3647

48+
private currentSize: string = 'small';
49+
3750
constructor(public navCtrl: NavController) {
3851

3952
}
4053

4154
changeColor() {
55+
4256
this.colorCount++;
4357
if (this.colorCount < this.colorArr.length) {
4458
this.currentColor = this.colorArr[this.colorCount];
@@ -48,4 +62,8 @@ export class HomePage {
4862
}
4963
}
5064

65+
changeSize() {
66+
this.currentSize = (this.currentSize === 'small' ? 'large' : 'small');
67+
}
68+
5169
}

0 commit comments

Comments
 (0)