Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · Markers on the globe

canvasRatiofunction

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 it

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

Definition

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

Parameters

NameTypeDescription
widthnumber

The canvas's width in CSS pixels.

heightnumber

The canvas's height in CSS pixels.

deviceRationumber

The device's pixel ratio.

maxSide (optional)number

The most pixels on a side.

maxPixels (optional)number

The most pixels in all.

Returns

number

The ratio to draw at, between 0.1 and 2.

Examples

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

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

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.11.0.