本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · SVG文字列としての地球儀

globe関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The globe as an SVG string, turned to rotation and drawn in style, size pixels square. It is pure: the same options always give the same markup, so it runs on a server, in a test or in a build step with no DOM.

インポート

import { globe } from "@johnmorrisdotca/chikyu-earth";

定義

function globe(options?: GlobeOptions): string

引数

名前型説明
options (省略可)GlobeOptions

Size, turn, look and graticule; every one has a default, so globe() draws a 320-pixel globe facing the Greenwich meridian.

戻り値

string

One <svg> element as text, with the country outlines as paths.

例

import { globe } from "@johnmorrisdotca/chikyu-earth";

const svg = globe({ size: 240, rotation: [-139.7, -35.7], style: "line" });
console.log(svg.slice(0, 60));
console.log(svg.length > 10_000);
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。