本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス · カードの絵柄

cardFaceFromArt関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A card's face from artwork of your own: art is SVG markup (or a whole <svg> document) drawn on the card's paper in a box 100 by 140, or in box, fitted to the card's height and centred; a whole <svg> is used as it is. It is how a page draws a card no deck has, for one card, with no design registered. frame: "none" leaves the paper out for art that fills the card. Scripts, handlers and foreign objects are taken out of the markup.

インポート

import { cardFaceFromArt } from "@johnmorrisdotca/toranpu/card-faces";

定義

function cardFaceFromArt(art: string, options?: Omit<CardFaceOptions, "design"> & { box?: readonly [number, number]; frame?: "paper" | "none"; }): string

引数

名前型説明
artstring

SVG markup for the face artwork.

options (省略可)Omit<CardFaceOptions, "design"> & { box?: readonly [number, number]; frame?: "paper" | "none"; }

Options for this call; omitted fields retain their documented defaults.

戻り値

string

A card's face from artwork of your own: art is SVG markup (or a whole <svg> document) drawn on the card's paper in a box 100 by 140, or in box, fitted to the card's height and centred; a whole <svg> is used as it is. It is how a page draws a card no deck has, for one card, with no design registered. frame: "none" leaves the paper out for art that fills the card. Scripts, handlers and foreign objects are taken out of the markup.

例

import { cardFaceFromArt } from "@johnmorrisdotca/toranpu/card-faces";

console.log(cardFaceFromArt(`<circle cx="50" cy="70" r="20" fill="#2f5d4a"/>`).slice(0, 160));
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 140" aria-hidden="true" style="user-select:none;-webkit-user-select:none"><rect x=".5" y=".5" width="99

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/toranpu 2.15.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。