本文へ移動

Koyomi Calendars暦

カレンダーのページをSVGで描きます。1日を18種類のアイコンで、1か月をポスターや卓上カレンダーで、そして日めくりも使えます。

「暦」(こよみ) は、カレンダーのことです。 名前について(英語)

目次

リファレンス · /animate

flipCalendar関数

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

Turns the icon in host from one date to another.

It needs a browser (the Web Animations API). The host's content afterwards is the one new icon, as if drawn plainly.

インポート

import { flipCalendar } from "@johnmorrisdotca/koyomi-calendars/animate";

定義

function flipCalendar(host: HTMLElement, options: FlipOptions): Promise<FlipDate>

引数

名前型説明
hostHTMLElement

The element that holds the icon now.

optionsFlipOptions

How to draw a date, the two dates and the animation: FlipOptions.

戻り値

Promise<FlipDate>

The date now shown, once the turn has finished (options.to).

例

import { calendarIcon } from "@johnmorrisdotca/koyomi-calendars";
import { flipCalendar } from "@johnmorrisdotca/koyomi-calendars/animate";

const host = document.querySelector<HTMLElement>("#today")!;
await flipCalendar(host, {
  render: (date) => calendarIcon({ theme: "pins", ...date }),
  from: { year: 2026, month: 11, day: 3 },
  to: { year: 2026, month: 11, day: 4 },
});

ソースを見るGitHub で編集@johnmorrisdotca/koyomi-calendars 0.3.0 のソースから作成しました。

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