svg定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The flag of Ohio (オハイオ州), US-OH, as an SVG string: viewBox 26 by 16 (1.625:1), 1.4 KB. From Wikimedia Commons, "Flag of Ohio.svg" (public domain); the /manifest entry gives its author, licence and why it was chosen. It has a viewBox and no width or height, so it fills the box it is put in at its own aspect ratio.
インポート
import { svg } from "@johnmorrisdotca/hata/flags/us-oh";
定義
const svg: string = "<svg data-hata=\"us-oh\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 26 16\"><defs><clipPath id=\"hata-us-oh-d\"><path d=\"M0 16V0l26 3-6 5 6 5z\"/></clipPath><g id=\"hata-us-oh-e\" fill=\"#fff\" transform=\"translate(3.944272,0) scale(0.625)\"><g id=\"hata-us-oh-c\"><g id=\"hata-us-oh-b\"><path id=\"hata-us-oh-a\" d=\"M1 0H0v.5z\" transform=\"rotate(18,1,0)\"/><use href=\"#hata-us-oh-a\" transform=\"scale(1,-1)\"/></g><use href=\"#hata-us-oh-b\" transform=\"rotate(72)\"/></g><use href=\"#hata-us-oh-b\" transform=\"rotate(-72)\"/><use href=\"#hata-us-oh-c\" transform=\"rotate(144)\"/></g></defs><g fill=\"#fff\" stroke=\"#bf0a30\" clip-path=\"url(#hata-us-oh-d)\"><path stroke-width=\"4\" d=\"M26 3 0 0v16l26-3\"/><path stroke-width=\"2\" d=\"M0 8h26\"/></g><path fill=\"#00205b\" d=\"M0 0v16l16-8z\"/><g transform=\"translate(4.944272,8)\"><circle r=\"3\" fill=\"#fff\"/><circle r=\"2\" fill=\"#bf0a30\"/><use x=\"4\" href=\"#hata-us-oh-e\"/><g id=\"hata-us-oh-f\"><use href=\"#hata-us-oh-e\"/><use x=\"2\" href=\"#hata-us-oh-e\" transform=\"rotate(-9.650225)\"/><use x=\"2\" href=\"#hata-us-oh-e\" transform=\"rotate(9.650225)\"/></g><g id=\"hata-us-oh-g\"><use href=\"#hata-us-oh-e\" transform=\"rotate(63.434949)\"/><use href=\"#hata-us-oh-e\" transform=\"rotate(92.576212)\"/><use href=\"#hata-us-oh-f\" transform=\"rotate(121.717474)\"/><use href=\"#hata-us-oh-e\" transform=\"rotate(150.858737)\"/></g><use href=\"#hata-us-oh-e\" transform=\"rotate(180)\"/><use href=\"#hata-us-oh-g\" transform=\"scale(1,-1)\"/></g></svg>"
例
例 1
import flag from "@johnmorrisdotca/hata/flags/us-oh";
const host=document.createElement("div");
host.innerHTML = flag; // or toDataUri(flag) from "@johnmorrisdotca/hata" for an <img src>
console.log(host.querySelector("svg")?.getAttribute("viewBox"));例 2
import { svg } from "@johnmorrisdotca/hata/flags/us-oh";
console.log(svg.startsWith("<svg"),svg.length);true 1427出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。