本文へ移動

Chikyu Earth地球

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

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

目次

リファレンス · 地球上の目印

canvasRatio関数

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

The pixel ratio for an overlay canvas: the device's, to 2, held to 4096 a side and 6 million pixels (the same budget as the 3D canvas).

インポート

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

定義

function canvasRatio(width: number, height: number, deviceRatio: number, maxSide?: number, maxPixels?: number): number

引数

名前型説明
widthnumber

The canvas's width in CSS pixels.

heightnumber

The canvas's height in CSS pixels.

deviceRationumber

The device's pixel ratio.

maxSide (省略可)number

The most pixels on a side.

maxPixels (省略可)number

The most pixels in all.

戻り値

number

The ratio to draw at, between 0.1 and 2.

例

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

console.log(canvasRatio(420, 420, 3), canvasRatio(5000, 3000, 2));
2 0.6324555320336759

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

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

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