-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(animations): update angular to standalone (#3911)
- Loading branch information
1 parent
5c0f307
commit 70ae31d
Showing
18 changed files
with
304 additions
and
218 deletions.
There are no files selected for viewing
13 changes: 7 additions & 6 deletions
13
static/usage/v7/animations/basic/angular/example_component_ts.md
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
54 changes: 31 additions & 23 deletions
54
static/usage/v7/animations/before-and-after-hooks/angular/example_component_ts.md
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
104 changes: 58 additions & 46 deletions
104
static/usage/v7/animations/chain/angular/example_component_ts.md
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,73 +1,85 @@ | ||
```ts | ||
import { Component, ElementRef, ViewChildren } from '@angular/core'; | ||
import { AnimationController, IonButton, IonCard, IonCardContent } from '@ionic/angular/standalone'; | ||
import type { QueryList } from '@angular/core'; | ||
import type { Animation } from '@ionic/angular'; | ||
import { AnimationController, IonCard } from '@ionic/angular'; | ||
import type { Animation } from '@ionic/angular/standalone'; | ||
|
||
@Component({ | ||
selector: 'app-example', | ||
templateUrl: 'example.component.html', | ||
styleUrls: ['example.component.css'], | ||
imports: [IonButton, IonCard, IonCardContent], | ||
}) | ||
export class ExampleComponent { | ||
@ViewChildren(IonCard, { read: ElementRef }) cardElements: QueryList<ElementRef<HTMLIonCardElement>>; | ||
@ViewChildren(IonCard, { read: ElementRef }) cardElements!: QueryList<ElementRef<HTMLIonCardElement>>; | ||
|
||
private cardA: Animation; | ||
private cardB: Animation; | ||
private cardC: Animation; | ||
private cardA!: Animation | null; | ||
private cardB!: Animation | null; | ||
private cardC!: Animation | null; | ||
|
||
constructor(private animationCtrl: AnimationController) {} | ||
|
||
ngAfterViewInit() { | ||
this.cardA = this.animationCtrl | ||
.create() | ||
.addElement(this.cardElements.get(0).nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1) rotate(0)' }, | ||
{ offset: 0.5, transform: 'scale(1.2) rotate(45deg)' }, | ||
{ offset: 1, transform: 'scale(1) rotate(0)' }, | ||
]); | ||
const cardElA = this.cardElements.get(0); | ||
const cardElB = this.cardElements.get(1); | ||
const cardElC = this.cardElements.get(2); | ||
|
||
this.cardB = this.animationCtrl | ||
.create() | ||
.addElement(this.cardElements.get(1).nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1)', opacity: '1' }, | ||
{ offset: 0.5, transform: 'scale(1.2)', opacity: '0.3' }, | ||
{ offset: 1, transform: 'scale(1)', opacity: '1' }, | ||
]); | ||
this.cardA = cardElA | ||
? this.animationCtrl | ||
.create() | ||
.addElement(cardElA.nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1) rotate(0)' }, | ||
{ offset: 0.5, transform: 'scale(1.2) rotate(45deg)' }, | ||
{ offset: 1, transform: 'scale(1) rotate(0)' }, | ||
]) | ||
: null; | ||
|
||
this.cardC = this.animationCtrl | ||
.create() | ||
.addElement(this.cardElements.get(2).nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1)', opacity: '0.5' }, | ||
{ offset: 0.5, transform: 'scale(0.8)', opacity: '1' }, | ||
{ offset: 1, transform: 'scale(1)', opacity: '0.5' }, | ||
]); | ||
this.cardB = cardElB | ||
? this.animationCtrl | ||
.create() | ||
.addElement(cardElB.nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1)', opacity: '1' }, | ||
{ offset: 0.5, transform: 'scale(1.2)', opacity: '0.3' }, | ||
{ offset: 1, transform: 'scale(1)', opacity: '1' }, | ||
]) | ||
: null; | ||
|
||
this.cardC = cardElC | ||
? this.animationCtrl | ||
.create() | ||
.addElement(cardElC.nativeElement) | ||
.fill('none') | ||
.duration(1000) | ||
.keyframes([ | ||
{ offset: 0, transform: 'scale(1)', opacity: '0.5' }, | ||
{ offset: 0.5, transform: 'scale(0.8)', opacity: '1' }, | ||
{ offset: 1, transform: 'scale(1)', opacity: '0.5' }, | ||
]) | ||
: null; | ||
} | ||
|
||
async play() { | ||
await this.cardA.play(); | ||
await this.cardB.play(); | ||
await this.cardC.play(); | ||
await this.cardA?.play(); | ||
await this.cardB?.play(); | ||
await this.cardC?.play(); | ||
} | ||
|
||
pause() { | ||
this.cardA.pause(); | ||
this.cardB.pause(); | ||
this.cardC.pause(); | ||
this.cardA?.pause(); | ||
this.cardB?.pause(); | ||
this.cardC?.pause(); | ||
} | ||
|
||
stop() { | ||
this.cardA.stop(); | ||
this.cardB.stop(); | ||
this.cardC.stop(); | ||
async stop() { | ||
await this.cardA?.stop(); | ||
await this.cardB?.stop(); | ||
await this.cardC?.stop(); | ||
} | ||
} | ||
``` |
13 changes: 7 additions & 6 deletions
13
static/usage/v7/animations/gesture/angular/example_component_ts.md
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
10 changes: 6 additions & 4 deletions
10
static/usage/v7/animations/keyframes/angular/example_component_ts.md
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
30 changes: 22 additions & 8 deletions
30
static/usage/v7/animations/modal-override/angular/example_component_ts.md
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.