Two pulses of light with glowing tails race in opposite directions along a thin line and light its end caps.
▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁ ◆━━━━━━●───────────────────────────────────●━━━━━━━────────────────────────────────────────────◆ ▔▔▔▔▔▔▔ ▔▔▔▔▔▔▔▔▔
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="pulse-line"></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/pulse-line.js";
export function PulseLine() {
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 pulse-line<!-- Export the GIF below in the look you picked, commit it, then: -->
<p align="center">
<img src="assets/pulse-line.gif" alt="Pulse Line, animated ASCII art" width="720">
</p>Add the animated ASCII art piece "pulse-line" (Pulse Line) 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="pulse-line"></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/pulse-line
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.
/* pulse-line: pulses of light with glowing tails racing along a thin line. */
import { Grid, palette, gradient, KEYS } from "../lib/kit.js";
const CY = gradient(["#21262d", "#1f4f7a", "#2f8fd8", "#79c0ff", "#d6ecff", "#ffffff"], 10); // 0..9
const OR = gradient(["#21262d", "#6a3a14", "#c46a22", "#ffa657", "#ffe1c2", "#ffffff"], 10); // 10..19
export const meta = {
slug: "pulse-line",
name: "Pulse Line",
category: "frames",
note: "Two pulses of light with glowing tails race in opposite directions along a thin line and light its end caps.",
tags: ["divider", "readme", "line", "glow", "separator", "loader"],
cols: 96, rows: 3, fps: 30,
palette: palette([...CY, ...OR]),
};
export default function create() {
const { cols } = meta;
const g = new Grid(cols, meta.rows);
const span = cols + 40;
return (t) => {
g.clear();
const pa = ((t * 34) % span) - 10; // cyan, left to right
const pb = cols - (((t * 26 + 50) % span) - 10); // orange, right to left
for (let x = 1; x < cols - 1; x++) {
const da = pa - x, db = x - pb;
const ia = da >= 0 ? Math.exp(-da / 7) : Math.exp(da * 1.5);
const ib = db >= 0 ? Math.exp(-db / 7) : Math.exp(db * 1.5);
const [i, base] = ia >= ib ? [ia, 0] : [ib, 10];
if (i < 0.06) { g.set(x, 1, "─", KEYS[0]); continue; }
const head = Math.abs(ia >= ib ? da : db) < 0.6;
g.set(x, 1, head ? "●" : i > 0.35 ? "━" : "─", KEYS[base + Math.min(9, 1 + Math.floor(i * 9))]);
if (i > 0.3) {
const k = KEYS[base + Math.min(9, Math.floor(i * 6))];
g.set(x, 0, "▁", k); g.set(x, 2, "▔", k);
}
}
const capA = Math.max(Math.exp(-Math.abs(pa - (cols - 1)) / 3), Math.exp(-Math.abs(pb - (cols - 1)) / 3));
const capB = Math.max(Math.exp(-Math.abs(pa) / 3), Math.exp(-Math.abs(pb) / 3));
g.set(0, 1, "◆", KEYS[2 + Math.floor(capB * 7)]);
g.set(cols - 1, 1, "◆", KEYS[2 + Math.floor(capA * 7)]);
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.