Skip to content

Commit

Permalink
MET-6314 Animation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjmaclean committed Jan 21, 2025
1 parent 25f0ace commit 85e3d43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/app/chart/map/map.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ describe('MapComponent', () => {
hide: jasmine.createSpy()
} as unknown as am4maps.MapChart;
component.chartGlobe = {
show: jasmine.createSpy()
show: jasmine.createSpy(),
animate: jasmine.createSpy()
} as unknown as am4maps.MapChart;

component.showGlobe();
expect(component.chart.hide).toHaveBeenCalled();
expect(component.chartGlobe.show).toHaveBeenCalled();
expect(component.chartGlobe.animate).toHaveBeenCalled();
});

it('should update the data', () => {
Expand Down
10 changes: 9 additions & 1 deletion src/app/chart/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ export class MapComponent extends SubscriptionManager {
showGlobe(): void {
this.chart.hide();
this.chartGlobe.show();
this.animateLatitude();
}

animateLatitude(): void {
this.chartGlobe.deltaLatitude = -45;
this.chartGlobe.animate({ property: 'deltaLatitude', to: 0 }, 5000, am4core.ease.circleOut );
}

/** drawChart
Expand Down Expand Up @@ -608,11 +614,13 @@ export class MapComponent extends SubscriptionManager {
this.chartGlobe = chartGlobe;
this.hideGlobe();

chartGlobe.deltaLongitude = -45;
chartGlobe.projection = new am4maps.projections.Orthographic();
chartGlobe.series.push(new am4maps.MapPolygonSeries()).useGeodata = true;
chartGlobe.seriesContainer.resizable = false;
chartGlobe.seriesContainer.draggable = false;
chartGlobe.animate({ property: 'deltaLongitude', to: 100000 }, 20000000);

chartGlobe.animate({ property: 'deltaLongitude', to: 100050 }, 20000000);
setTimeout(() => {
chartGlobe.geodata = am4geodata_worldHigh;
const label = chartGlobe.chartAndLegendContainer.createChild(
Expand Down

0 comments on commit 85e3d43

Please sign in to comment.