リファレンス · 数値から描いた星のSVGの絵と、太陽との大きさくらべ
starPortrait関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A star drawn from its numbers as SVG text: a disc in the colour of its temperature, darker toward the edge by its limb-darkening coefficient, with a generic surface texture of the right kind of cells for its type, and, for Altair and Regulus, the flattened and gravity-darkened shape that interferometers measured, and for Vega the round face of a star seen over its pole. The picture says, in its own words, that it is drawn from numbers and that the texture is generic. Nothing in it is a photograph or an artist's guess at one star's markings.
インポート
import { starPortrait } from "@johnmorrisdotca/hoshi-stars/portrait";
定義
function starPortrait(profile: StarProfile, options?: PortraitOptions): string | undefined
引数
| 名前 | 型 | 説明 |
|---|---|---|
profile | StarProfile | A star's profile from |
options (省略可) | PortraitOptions | Size, language, name, background and captions. |
戻り値
string | undefined
An SVG document as a string, or undefined where the profile has no temperature to draw.
例
import { starByName } from "@johnmorrisdotca/hoshi-stars";
import { starProfile } from "@johnmorrisdotca/hoshi-stars/profile";
import { starPortrait } from "@johnmorrisdotca/hoshi-stars/portrait";
const svg = starPortrait(starProfile(starByName("Betelgeuse")!), { name: "Betelgeuse", size: 320 });
console.log(svg?.slice(0, 40));<svg xmlns="http://www.w3.org/2000/svg"出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。