@maptiler/sdk 3.0.2 → 3.1.0-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -533,7 +533,125 @@ map.on("terrainAnimationStop", (e) => {
533
533
  });
534
534
  });
535
535
  ```
536
+ # Halo and Space Options
536
537
 
538
+ The `halo` and `space` options allow for enhanced visual customization of the map, especially for globe projections.
539
+
540
+ ## `halo` (Atmospheric Glow)
541
+ The `halo` option adds a gradient-based atmospheric glow around the globe, simulating the visual effect of Earth's atmosphere when viewed from space.
542
+
543
+ ### Usage:
544
+ You can enable a simple halo by setting it to `true`:
545
+ ```ts
546
+ const map = new maptilersdk.Map({
547
+ container: document.getElementById("map"),
548
+ style: maptilersdk.MapStyle.OUTDOOR,
549
+ halo: true,
550
+ });
551
+ ```
552
+ For more customization, you can define a radial gradient with scale and stops:
553
+ ```ts
554
+
555
+ const map = new maptilersdk.Map({
556
+ container: document.getElementById("map"),
557
+ style: maptilersdk.MapStyle.OUTDOOR,
558
+ halo: {
559
+ scale: 1.5, // Controls the halo size
560
+ stops: [
561
+ [0.2, "transparent"],
562
+ [0.2, "red"],
563
+ [0.4, "red"],
564
+ [0.4, "transparent"],
565
+ [0.6, "transparent"],
566
+ [0.6, "red"],
567
+ [0.8, "red"],
568
+ [0.8, "transparent"],
569
+ [1.0, "transparent"],
570
+ ],
571
+ },
572
+ });
573
+ ```
574
+ You can also set the halo dynamically after the map loads:
575
+ ```ts
576
+ map.on("load", () => {
577
+ map.setHalo({
578
+ scale: 2,
579
+ stops: [
580
+ [0.0, "rgba(135,206,250,1)"],
581
+ [0.5, "rgba(0,0,250,0.75)"],
582
+ [0.75, "rgba(250,0,0,0.0)"],
583
+ ],
584
+ });
585
+ });
586
+ ```
587
+ ## `space` (Background Environment)
588
+
589
+ The space option allows customizing the background environment of the globe, simulating deep space or skybox effects.
590
+ ### Usage
591
+
592
+ You can enable a simple space background with a solid color:
593
+ ```ts
594
+ const map = new maptilersdk.Map({
595
+ container: document.getElementById("map"),
596
+ style: maptilersdk.MapStyle.OUTDOOR,
597
+ space: {
598
+ color: "#111122", // Dark space-like color
599
+ },
600
+ });
601
+ ```
602
+ Alternatively, you can provide a cubemap for a realistic skybox effect using one of the following methods:
603
+
604
+ Predefined Presets:
605
+ ```ts
606
+ const map = new maptilersdk.Map({
607
+ container: document.getElementById("map"),
608
+ style: maptilersdk.MapStyle.OUTDOOR,
609
+ space: {
610
+ preset: "universe-dark",
611
+ },
612
+ });
613
+ ```
614
+ Cubemap Images (Custom Skybox):
615
+ ```ts
616
+ const map = new maptilersdk.Map({
617
+ container: document.getElementById("map"),
618
+ style: maptilersdk.MapStyle.OUTDOOR,
619
+ space: {
620
+ faces: {
621
+ pX: '/path-to-image/pX.png',
622
+ nX: '/path-to-image/nX.png',
623
+ pY: '/path-to-image/pY.png',
624
+ nY: '/path-to-image/nY.png',
625
+ pZ: '/path-to-image/pZ.png',
626
+ nZ: '/path-to-image/nZ.png',
627
+ },
628
+ },
629
+ });
630
+ ```
631
+ Cubemap Path with image format, fetches all images from a path, this assumes all files are named px, nx, py, ny, pz, nz and suffixed with the appropriate extension specified in `format`.
632
+ ```ts
633
+ const map = new maptilersdk.Map({
634
+ container: document.getElementById("map"),
635
+ style: maptilersdk.MapStyle.OUTDOOR,
636
+ space: {
637
+ path: {
638
+ baseUrl: "spacebox/transparent",
639
+ format: "png", // Defaults to PNG
640
+ },
641
+ },
642
+ });
643
+ ```
644
+ You can also set the space background dynamically:
645
+ ```ts
646
+ map.on("load", () => {
647
+ map.setSpace({
648
+ color: "red",
649
+ path: {
650
+ baseUrl: "spacebox/transparent",
651
+ },
652
+ });
653
+ });
654
+ ```
537
655
 
538
656
  # Easy language switching
539
657
  The language generally depends on the style but we made it possible to easily set and update from a built-in list of languages.