|
1 | 1 | <script>
|
2 | 2 | import createGlobe from 'cobe';
|
3 | 3 | import { onMount } from 'svelte';
|
4 |
| - import Grow from './grow.png'; |
| 4 | +
|
| 5 | + // @vedam, aren't svgs smaller in size and at better quality than .pngs? |
| 6 | + import Grow from './grow.svg'; |
5 | 7 |
|
6 | 8 | let canvas;
|
7 | 9 | let phi = 0;
|
8 | 10 |
|
9 | 11 | onMount(() => {
|
| 12 | + // @vedam, tweaked the values here |
10 | 13 | const globe = createGlobe(canvas, {
|
11 | 14 | devicePixelRatio: 2,
|
12 | 15 | width: 1000 * 2,
|
13 | 16 | height: 1000 * 2,
|
14 | 17 | phi: 0,
|
15 | 18 | theta: 0,
|
16 |
| - dark: 1, |
17 |
| - diffuse: 1.2, |
| 19 | + dark: 0.1, |
| 20 | + diffuse: 0.6, |
18 | 21 | mapSamples: 16000,
|
19 |
| - mapBrightness: 6, |
20 |
| - baseColor: [0.3, 0.3, 0.3], |
21 |
| - markerColor: [0.1, 0.8, 1], |
22 |
| - glowColor: [1, 1, 1], |
23 |
| - offset: [0, 2000], |
| 22 | + mapBrightness: 4, |
| 23 | + baseColor: [0.9137, 0.9098, 0.9019], // the light warm grey from figma |
| 24 | + markerColor: [1, 0.2431, 0], // our --primary |
| 25 | + glowColor: [1, 1, 1], // white |
| 26 | + offset: [0, 2100], |
24 | 27 | markers: [
|
25 | 28 | // https://vercel.com/docs/concepts/edge-network/regions
|
26 |
| - { location: [59.3293, 18.0686], size: 0.1 }, // Stockholm |
27 |
| - { location: [19.0760, 72.8777], size: 0.1 }, // Mumbai |
28 |
| - { location: [48.8566, 2.3522], size: 0.1 }, // Paris |
29 |
| - { location: [41.4993, -81.6944], size: 0.1 }, // Cleveland |
30 |
| - { location: [-33.9249, 18.4241], size: 0.1 }, // Cape Town |
31 |
| - { location: [53.3498, -6.2603], size: 0.1 }, // Dublin |
32 |
| - { location: [50.1109, 8.6821], size: 0.1 }, // Frankfurt |
33 |
| - { location: [-23.5558, -46.6396], size: 0.1 }, // São Paulo |
34 |
| - { location: [22.3193, 114.1694], size: 0.1 }, // Hong Kong |
35 |
| - { location: [35.6762, 139.6503], size: 0.1 }, // Tokyo |
36 |
| - { location: [38.9072, -77.0369], size: 0.1 }, // DC |
37 |
| - { location: [37.5665, 126.9780], size: 0.1 }, // Seoul |
38 |
| - { location: [34.6937, 135.5023], size: 0.1 }, // Osaka |
39 |
| - { location: [51.5072, -0.1276], size: 0.1 }, // London |
40 |
| - { location: [45.5152, -122.6784], size: 0.1 }, // Portland |
41 |
| - { location: [37.7595, -122.4367], size: 0.1 }, // SF |
42 |
| - { location: [1.3521, 103.8198], size: 0.1 }, // Singapore |
43 |
| - { location: [-33.8688, 151.2093], size: 0.1 } // Sydney |
| 29 | + { location: [59.3293, 18.0686], size: 0.05 }, // Stockholm |
| 30 | + { location: [19.076, 72.8777], size: 0.05 }, // Mumbai |
| 31 | + { location: [48.8566, 2.3522], size: 0.05 }, // Paris |
| 32 | + { location: [41.4993, -81.6944], size: 0.05 }, // Cleveland |
| 33 | + { location: [-33.9249, 18.4241], size: 0.05 }, // Cape Town |
| 34 | + { location: [53.3498, -6.2603], size: 0.05 }, // Dublin |
| 35 | + { location: [50.1109, 8.6821], size: 0.05 }, // Frankfurt |
| 36 | + { location: [-23.5558, -46.6396], size: 0.05 }, // São Paulo |
| 37 | + { location: [22.3193, 114.1694], size: 0.05 }, // Hong Kong |
| 38 | + { location: [35.6762, 139.6503], size: 0.05 }, // Tokyo |
| 39 | + { location: [38.9072, -77.0369], size: 0.05 }, // DC |
| 40 | + { location: [37.5665, 126.978], size: 0.05 }, // Seoul |
| 41 | + { location: [34.6937, 135.5023], size: 0.05 }, // Osaka |
| 42 | + { location: [51.5072, -0.1276], size: 0.05 }, // London |
| 43 | + { location: [45.5152, -122.6784], size: 0.05 }, // Portland |
| 44 | + { location: [37.7595, -122.4367], size: 0.05 }, // SF |
| 45 | + { location: [1.3521, 103.8198], size: 0.05 }, // Singapore |
| 46 | + { location: [-33.8688, 151.2093], size: 0.05 } // Sydney |
44 | 47 | ],
|
45 |
| - onRender: state => { |
| 48 | + onRender: (state) => { |
46 | 49 | state.phi = phi;
|
47 | 50 | phi += 0.008;
|
48 | 51 | }
|
49 | 52 | });
|
50 | 53 | });
|
51 | 54 | </script>
|
52 | 55 |
|
53 |
| -<h3>SvelteKit grows with you,<br/><span style="font-weight:bold">whatever</span> you're building</h3> |
| 56 | +<h3> |
| 57 | + SvelteKit grows with you,<br /><span style="font-weight:bold">whatever</span> you're building |
| 58 | +</h3> |
54 | 59 |
|
55 | 60 | <img src={Grow} alt="Build SSGs, MPAs, PWAs, or SPAs." />
|
56 | 61 |
|
57 |
| -<canvas bind:this={canvas} style="width: 1000px; height: 500px;" /> |
| 62 | +<!-- @vedam see styles --> |
| 63 | +<div class="canvas-wrap"> |
| 64 | + <canvas bind:this={canvas} class="globe" width="1800" height="400" /> |
| 65 | +</div> |
| 66 | + |
| 67 | +<div class="box"> |
| 68 | + <p>From your local machine<br />to the edge of the world</p> |
| 69 | +</div> |
58 | 70 |
|
59 | 71 | <style>
|
60 | 72 | h3 {
|
61 | 73 | margin-bottom: 3rem;
|
62 | 74 | }
|
63 | 75 |
|
64 | 76 | img {
|
| 77 | + position: relative; |
| 78 | + /* @vedam - Dirty hack part 1 |
| 79 | + Unfortunately I'm not able to handle the positioning/sizing correctly. |
| 80 | + At least not in a reasonable amount of time. |
| 81 | + So I tried this ugly, failing workaround. Sorry. |
| 82 | + Only looks correct at arround 1500px viewport-width. |
| 83 | + This should be done by someone who has a clue about what he's doing. |
| 84 | + |
| 85 | + These 7em at bottom are to push "Starts fast" down. |
| 86 | + */ |
| 87 | + margin: 5em 0 7em 0; |
65 | 88 | width: 100%;
|
66 | 89 | height: auto;
|
| 90 | + z-index: 1; |
| 91 | + } |
| 92 | +
|
| 93 | + /* @vedam - Dirty hack part 2 */ |
| 94 | + .canvas-wrap { |
| 95 | + position: absolute; |
| 96 | + top: 18.6em; |
| 97 | + left: -10.14vw; |
| 98 | + right: 0; |
| 99 | + bottom: 0; |
| 100 | + width: 100vw; |
| 101 | + height: 500px; |
| 102 | + overflow: hidden; |
| 103 | + z-index: -1; |
| 104 | + /* background-color: #ccc; */ |
| 105 | + } |
| 106 | +
|
| 107 | + /* @vedam - Dirty hack part 3 */ |
| 108 | + .globe { |
| 109 | + margin-left: -16.5vw; |
| 110 | + } |
| 111 | +
|
| 112 | + .box { |
| 113 | + position: absolute; |
| 114 | + max-width: 236px; |
| 115 | + right: -2em; |
| 116 | + bottom: 0; |
| 117 | + padding: 1.2em 1.6em 0.5em; |
| 118 | + background-color: var(--prime); |
| 119 | + color: white; |
| 120 | + border-radius: var(--border-r); |
| 121 | + z-index: 1; |
67 | 122 | }
|
68 | 123 | </style>
|
0 commit comments