Loading src/app/landing/landing.component.html +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ </div> <div class="card-body p-3"> <div *ngIf="isLoading; else apiRespondedUsers"> <h5 class="card-title"><skeleton [width]="'35%'"></skeleton></h5> <h5 class="card-title"><skeleton [width]="'35%'" [height]="'1.25rem'"></skeleton></h5> </div> <ng-template #apiRespondedUsers> <h5 class="card-title font-weight-bold">{{isNaN(animatedCounts.registeredUsers) ? 'NaN': animatedCounts.registeredUsers}}</h5> Loading src/app/landing/landing.component.ts +24 −55 Original line number Diff line number Diff line Loading @@ -31,9 +31,6 @@ export class LandingComponent implements OnInit { @ViewChild('videoRef', { static: true }) videoElement!: ElementRef<HTMLIFrameElement>; // Metrics section variables // registeredUsers = 9999; // publishedServiceSpecs = 9999; // registeredResourceSpecs = 9999; animatedCounts = { registeredUsers: NaN, publishedServiceSpecs: NaN, Loading Loading @@ -75,7 +72,7 @@ export class LandingComponent implements OnInit { }) ) }) .pipe(delay(1000)) .pipe(delay(500)) .subscribe( results => { Loading Loading @@ -166,14 +163,14 @@ export class LandingComponent implements OnInit { // } startAnimation() { const stepTime = 50; // Initialize counts to NaN if the target is NaN (api didn't respond), otherwise start from 0 and animate the count this.animatedCounts = { registeredUsers: 0, publishedServiceSpecs: 0, registeredResourceSpecs: 0 } registeredUsers: isNaN(this.targetCounts.registeredUsers) ? NaN : 0, publishedServiceSpecs: isNaN(this.targetCounts.publishedServiceSpecs) ? NaN : 0, registeredResourceSpecs: isNaN(this.targetCounts.registeredResourceSpecs) ? NaN : 0 }; this.intervalId = setInterval(() => { for (const key in this.animatedCounts) { Loading @@ -196,34 +193,6 @@ export class LandingComponent implements OnInit { } infiniteLoopAnimation() { const stepTime = 50; let time = 0; const maxValues: { [key: string]: number } = {}; for (const key in this.animatedCounts) { maxValues[key] = Math.floor(Math.random() * 500) + 10; } this.intervalId = setInterval(() => { time += 0.1; for (const key in this.animatedCounts) { const k = key as keyof typeof this.animatedCounts; const maxValue = maxValues[key]; const triangleWave = 2 * Math.abs((time % 2) - 1) - 1; const normalizedTriangleWave = (triangleWave + 1) / 2; const apiNotRespondingValue = normalizedTriangleWave * maxValue; this.animatedCounts[k] = Math.round(apiNotRespondingValue); } }, stepTime); } ngOnDestroy() { if (this.intervalId) { clearInterval(this.intervalId); Loading Loading
src/app/landing/landing.component.html +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ </div> <div class="card-body p-3"> <div *ngIf="isLoading; else apiRespondedUsers"> <h5 class="card-title"><skeleton [width]="'35%'"></skeleton></h5> <h5 class="card-title"><skeleton [width]="'35%'" [height]="'1.25rem'"></skeleton></h5> </div> <ng-template #apiRespondedUsers> <h5 class="card-title font-weight-bold">{{isNaN(animatedCounts.registeredUsers) ? 'NaN': animatedCounts.registeredUsers}}</h5> Loading
src/app/landing/landing.component.ts +24 −55 Original line number Diff line number Diff line Loading @@ -31,9 +31,6 @@ export class LandingComponent implements OnInit { @ViewChild('videoRef', { static: true }) videoElement!: ElementRef<HTMLIFrameElement>; // Metrics section variables // registeredUsers = 9999; // publishedServiceSpecs = 9999; // registeredResourceSpecs = 9999; animatedCounts = { registeredUsers: NaN, publishedServiceSpecs: NaN, Loading Loading @@ -75,7 +72,7 @@ export class LandingComponent implements OnInit { }) ) }) .pipe(delay(1000)) .pipe(delay(500)) .subscribe( results => { Loading Loading @@ -166,14 +163,14 @@ export class LandingComponent implements OnInit { // } startAnimation() { const stepTime = 50; // Initialize counts to NaN if the target is NaN (api didn't respond), otherwise start from 0 and animate the count this.animatedCounts = { registeredUsers: 0, publishedServiceSpecs: 0, registeredResourceSpecs: 0 } registeredUsers: isNaN(this.targetCounts.registeredUsers) ? NaN : 0, publishedServiceSpecs: isNaN(this.targetCounts.publishedServiceSpecs) ? NaN : 0, registeredResourceSpecs: isNaN(this.targetCounts.registeredResourceSpecs) ? NaN : 0 }; this.intervalId = setInterval(() => { for (const key in this.animatedCounts) { Loading @@ -196,34 +193,6 @@ export class LandingComponent implements OnInit { } infiniteLoopAnimation() { const stepTime = 50; let time = 0; const maxValues: { [key: string]: number } = {}; for (const key in this.animatedCounts) { maxValues[key] = Math.floor(Math.random() * 500) + 10; } this.intervalId = setInterval(() => { time += 0.1; for (const key in this.animatedCounts) { const k = key as keyof typeof this.animatedCounts; const maxValue = maxValues[key]; const triangleWave = 2 * Math.abs((time % 2) - 1) - 1; const normalizedTriangleWave = (triangleWave + 1) / 2; const apiNotRespondingValue = normalizedTriangleWave * maxValue; this.animatedCounts[k] = Math.round(apiNotRespondingValue); } }, stepTime); } ngOnDestroy() { if (this.intervalId) { clearInterval(this.intervalId); Loading