A big seven segment clock ticking through the seconds, with ghosted unlit segments and a blinking colon.
████ ████ ████ ████ ░░░░ ████
░░ ██ ░░ ██ ██ ░░ ██ ██ ██ ██ ██ ██
░░ ██ ░░ ██ ██ ░░ ██ ██ ██ ██ ██ ██
░░ ██ ░░ ██ ░░ ██ ░░ ██ ██ ░░ ██ ██ ██ ██
░░ ██ ░░ ██ ██ ░░ ██ ██ ██ ██ ██ ██
████ ████ ████ ████ ████ ████
██ ░░ ░░ ██ ░░ ██ ░░ ██ ░░ ██ ██ ██
██ ░░ ░░ ██ ░░ ░░ ██ ░░ ██ ░░ ░░ ██ ██ ██
██ ░░ ░░ ██ ░░ ██ ░░ ██ ░░ ██ ██ ██
██ ░░ ░░ ██ ░░ ██ ░░ ██ ░░ ██ ██ ██
████ ████ ████ ████ ░░░░ ████
──────────────────────────────────────────────────────────────────
TUE 14 OCT 24H ALARM 06:30 · ● Paste two lines into any page, use it from React, play it in a terminal, put a GIF in a README, or hand the Agent prompt to your coding agent. Every tab follows the look you pick above.
<script type="module" src="https://www.ascii-magic.com/ascii/ascii.js"></script>
<ascii-art piece="digital-clock"></ascii-art>// npm install ascii-magic-art
import { useEffect, useRef } from "react";
import { play } from "ascii-magic-art/runtime/player.js";
import * as piece from "ascii-magic-art/pieces/digital-clock.js";
export function DigitalClock() {
const ref = useRef(null);
// play() draws the piece on a canvas in your look and returns stop(), which React runs on unmount
useEffect(() => play(ref.current, piece), []);
return <pre ref={ref} style={{ fontSize: 10, fontFamily: "Menlo, Consolas, monospace" }} />;
}npx ascii-magic-art digital-clock<!-- Export the GIF below in the look you picked, commit it, then: -->
<p align="center">
<img src="assets/digital-clock.gif" alt="Digital Clock, animated ASCII art" width="720">
</p>Add the animated ASCII art piece "digital-clock" (Digital Clock) from ASCII Magic to this project.
1. Load the script once, in the browser only (in SSR frameworks such as Next.js, load it on the client):
<script type="module" src="https://www.ascii-magic.com/ascii/ascii.js"></script>
2. Put the piece where it fits best, such as the hero, a loading state, an empty state or the 404 page:
<ascii-art piece="digital-clock"></ascii-art>
3. Keep a real heading or text next to it (the art is decoration), and size it with the size attribute or CSS.
Preview and options: https://www.ascii-magic.com/ascii/digital-clock
Rules for coding agents: https://www.ascii-magic.com/ascii/use/ai-coding-agentsPause on the frame you like, pick a look, then download it at an exact size.
MIT licensed and open source on GitHub. It imports one small helper file, kit.js. This is the animation itself: what gets drawn in every frame. The look you pick is applied on top by the player, like a filter, so this file stays the same in every look while the snippets above change with it. Edit it to change the animation; see the docs to make your own.
/* digital-clock: a big seven segment clock with ghosted unlit segments and a blinking colon. */
import { Grid, palette } from "../lib/kit.js";
export const meta = {
slug: "digital-clock",
name: "Digital Clock",
category: "lettering",
note: "A big seven segment clock ticking through the seconds, with ghosted unlit segments and a blinking colon.",
tags: ["clock", "time", "seven-segment", "dashboard", "hero"],
cols: 72, rows: 16, fps: 12,
palette: palette(["#ff6b5b", "#3a1f1f", "#8b949e", "#ffb3a8", "#30363d"]),
};
// segments a b c d e f g as bits
const DIG = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f];
const DAYS = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
export default function create() {
const g = new Grid(meta.cols, meta.rows);
const Y0 = 2;
const seg = (x, y, on, s) => {
const co = on ? "0" : "1", ch = on ? "█" : "░";
if (s === 0) g.hline(x + 2, x + 5, y, ch, co);
if (s === 6) g.hline(x + 2, x + 5, y + 5, ch, co);
if (s === 3) g.hline(x + 2, x + 5, y + 10, ch, co);
const v = (cx, y0) => { for (let j = 0; j < 4; j++) { g.set(cx, y0 + j, ch, co); g.set(cx + 1, y0 + j, ch, co); } };
if (s === 1) v(x + 6, y + 1);
if (s === 2) v(x + 6, y + 6);
if (s === 4) v(x, y + 6);
if (s === 5) v(x, y + 1);
};
const digit = (x, d) => {
for (let s = 0; s < 7; s++) if (!((DIG[d] >> s) & 1)) seg(x, Y0, false, s);
for (let s = 0; s < 7; s++) if ((DIG[d] >> s) & 1) seg(x, Y0, true, s);
};
const colon = (x, on) => {
for (const yy of [Y0 + 3, Y0 + 7]) { g.set(x, yy, on ? "█" : "░", on ? "0" : "1"); g.set(x + 1, yy, on ? "█" : "░", on ? "0" : "1"); }
};
return (t) => {
g.clear();
const total = 23 * 3600 + 59 * 60 + 48 + Math.floor(t); // starts 12 s before midnight rolls over
const s = total % 60, m = Math.floor(total / 60) % 60, h = Math.floor(total / 3600) % 24;
const day = Math.floor(total / 86400);
const blink = (t % 1) < 0.5;
const xs = [3, 13, 27, 37, 51, 61];
[Math.floor(h / 10), h % 10, Math.floor(m / 10), m % 10, Math.floor(s / 10), s % 10].forEach((d, i) => digit(xs[i], d));
colon(23, blink); colon(47, blink);
g.hline(3, 68, 14, "─", "4");
g.text(3, 15, `${DAYS[(1 + day) % 7]} ${String(14 + day).padStart(2, "0")} OCT`, "2");
g.text(30, 15, "24H", "3");
const al = "ALARM 06:30 ·";
g.text(68 - al.length - 1, 15, al, "2");
g.set(68, 15, "●", blink ? "0" : "1");
return g.frame();
};
}
/YOUR OWN
The pieces here are hand-built animations. To turn your own photo, logo or video into animated ASCII, use the ASCII Magic editor.