svg定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The flag of North Korea (北朝鮮), KP, drawn again by hand at 1:1 by flag-icons 7.5.0 (MIT), as an SVG string: viewBox 512 by 512, 785 B.
The drawing flag("KP", { shape: "1:1" }) uses (and the round frame, in a circle), made for that shape by hand rather than cut from the flag. The /manifest entry's framings say how each frame was chosen.
インポート
import { svg } from "@johnmorrisdotca/hata/flags/kp.1x1";
定義
const svg: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><defs><clipPath id=\"hata-kp-1x1-a\"><path fill-opacity=\".7\" d=\"M92.2 7.8h593.6v485.5H92.2z\"/></clipPath></defs><g fill-rule=\"evenodd\" clip-path=\"url(#hata-kp-1x1-a)\" transform=\"matrix(.86254 0 0 1.0546 -79.5 -8.3)\"><path fill=\"#fff\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M991.8 492.9H4.2V8.4h987.6z\"/><path fill=\"#3e5698\" d=\"M991.8 405.2H4.2V493h987.6z\"/><path fill=\"#c60000\" d=\"M991.8 384.9H4.2V116.4h987.6z\"/><path fill=\"#3e5698\" d=\"M991.8 8.4H4.2V96h987.6z\"/><path fill=\"#fff\" d=\"M473 250.7c0 60.1-61.5 108.9-137.4 108.9S198 310.8 198 250.6c0-60.1 61.6-108.9 137.6-108.9S473 190.5 473 250.7\"/><path fill=\"#c40000\" d=\"m402.9 326.8-66.1-38.6-67.1 39 26.3-62.8-66.1-38.5 82.4-.3 26.2-63 24.5 62.8 82.4-.4-67.2 39z\"/></g></svg>"
例
例 1
import square from "@johnmorrisdotca/hata/flags/kp.1x1";
const host=document.createElement("div");
host.innerHTML = square;
console.log(host.querySelector("svg")?.getAttribute("viewBox"));例 2
import { svg } from "@johnmorrisdotca/hata/flags/kp.1x1";
console.log(svg.startsWith("<svg"),svg.length);true 785出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。