Skip to the content

Koyomi Calendars暦

Calendar pages as SVG: a day as an icon in 18 original designs, a whole month as a poster or a desk pad, and the page turning from one day to the next.

Koyomi is the Japanese word 暦 for the calendar. About the name

Contents

Reference · /animate

flipCalendarfunction

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 it

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

Definition

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

Parameters

NameTypeDescription
hostHTMLElement

The element that holds the icon now.

optionsFlipOptions

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

Returns

Promise<FlipDate>

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

Examples

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 },
});

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/koyomi-calendars 0.3.0.