svg定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The flag of China (中国), CN, drawn again by hand at 1:1 by flag-icons 7.5.0 (MIT), as an SVG string: viewBox 512 by 512, 682 B.
The drawing flag("CN", { 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/cn.1x1";
定義
const svg: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><defs><path id=\"hata-cn-1x1-a\" fill=\"#ff0\" d=\"M1-.3-.7.8 0-1 .6.8-1-.3z\"/></defs><path fill=\"#ee1c25\" d=\"M0 0h512v512H0z\"/><use width=\"30\" height=\"20\" href=\"#hata-cn-1x1-a\" transform=\"translate(128 128)scale(76.8)\"/><use width=\"30\" height=\"20\" href=\"#hata-cn-1x1-a\" transform=\"rotate(-121 142.6 -47)scale(25.5827)\"/><use width=\"30\" height=\"20\" href=\"#hata-cn-1x1-a\" transform=\"rotate(-98.1 198 -82)scale(25.6)\"/><use width=\"30\" height=\"20\" href=\"#hata-cn-1x1-a\" transform=\"rotate(-74 272.4 -114)scale(25.6137)\"/><use width=\"30\" height=\"20\" href=\"#hata-cn-1x1-a\" transform=\"matrix(16 -19.968 19.968 16 256 230.4)\"/></svg>"
例
例 1
import square from "@johnmorrisdotca/hata/flags/cn.1x1";
const host=document.createElement("div");
host.innerHTML = square;
console.log(host.querySelector("svg")?.getAttribute("viewBox"));例 2
import { svg } from "@johnmorrisdotca/hata/flags/cn.1x1";
console.log(svg.startsWith("<svg"),svg.length);true 682出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。