本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · 各対戦の位置を計算

BackgroundOptions型

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

A preset, tuned: your own colours (hex or rgb(), the first two the ground), the gradient's angle, how strong the pattern is (0 to 1, default 0.6), a seed for the scattered parts, and which of its two variants.

インポート

import type { BackgroundOptions } from "@johnmorrisdotca/taisen-brackets/layout";

ほかのエクスポート元: @johnmorrisdotca/taisen-brackets

定義

interface BackgroundOptions {
    preset?: BackgroundPresetName;
    colors?: readonly string[];
    angle?: number;
    intensity?: number;
    seed?: number;
    theme?: "light" | "dark";
}

メンバー

名前型説明
preset (省略可)"midnight" | "crimson" | "royal" | "emerald" | "pitch" | "ice" | "hardwood" | "infield" | "turf" | "ball-panels" | "swirl" | "waves" | "glow" | "floodlights" | "confetti" | "carbon" | "aurora" | "sunburst" | "chevrons" | "halftone" | "argyle" | "contour" | "stardust" | "mesh" | "spotlight" | undefined

Default midnight.

colors (省略可)readonly string[] | undefined
angle (省略可)number | undefined
intensity (省略可)number | undefined
seed (省略可)number | undefined
theme (省略可)"light" | "dark" | undefined

light or dark: the variant to draw. By default the one of the drawing's look.

例

import { drawBracket, type BackgroundOptions } from "@johnmorrisdotca/taisen-brackets";

const background: BackgroundOptions = { preset: "aurora", intensity: 0.6, seed: 7 };
console.log(drawBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }], { background }).startsWith("<svg"));
true

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

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

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