MCPcopy Index your code
hub / github.com/NativeScript/nativescript-angular / LaunchAnimation

Class LaunchAnimation

e2e/animation-examples/app/main.ts:9–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7Trace.enable();
8
9class LaunchAnimation extends GridLayout implements AppLaunchView {
10 circle: GridLayout;
11 finished = false;
12 complete: () => void;
13
14 constructor() {
15 super();
16 this.backgroundColor = "#4caef7";
17 this.className = "w-full h-full";
18
19 // construct any creative animation
20 this.circle = new GridLayout();
21 this.circle.width = 30;
22 this.circle.height = 30;
23 this.circle.borderRadius = 15;
24 this.circle.horizontalAlignment = "center";
25 this.circle.verticalAlignment = "middle";
26 this.circle.backgroundColor = "#fff";
27
28 this.addChild(this.circle);
29 }
30
31 async startAnimation() {
32 await this.circle.animate({
33 scale: { x: 2, y: 2 },
34 duration: 800,
35 });
36
37 await this.circle.animate({
38 scale: { x: 1, y: 1 },
39 duration: 800,
40 });
41
42 if (this.finished) {
43 await this.circle.animate({
44 scale: { x: 30, y: 30 },
45 duration: 400,
46 });
47 this.fadeOut();
48 } else {
49 // keep looping
50 this.startAnimation();
51 }
52 }
53
54 cleanup() {
55 return new Promise((resolve) => {
56 this.complete = resolve;
57 this.finished = true;
58 });
59 }
60
61 async fadeOut() {
62 await this.animate({
63 opacity: 0,
64 duration: 400,
65 });
66 this.complete();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected