A doubled zigzag rule that scrolls sideways while a rainbow gradient slides along it.
╱╲ · ╱╲ • ╱╲ · ╱╲ · ╱╲ • ╱╲ • ╱╲ · ╱╲ · ╱╲ • ╱╲ · ╱╲ · ╱╲ ╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲╲ ╱╱╲ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲ ╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ ╲╲╱╱ · ╲╱ · ╲╱ • ╲╱ · ╲╱ · ╲╱ · ╲╱ • ╲╱ · ╲╱ · ╲╱ • ╲╱ • ╲╱ ·
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="zigzag-rule"></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/zigzag-rule.js";
export function ZigzagRule() {
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 zigzag-rule<!-- Export the GIF below in the look you picked, commit it, then: -->
<p align="center">
<img src="assets/zigzag-rule.gif" alt="Zigzag Rule, animated ASCII art" width="720">
</p>Add the animated ASCII art piece "zigzag-rule" (Zigzag Rule) 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="zigzag-rule"></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/zigzag-rule
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.
/* zigzag-rule: a doubled chevron zigzag scrolling sideways with a travelling colour gradient. */
import { Grid, palette, gradient, KEYS } from "../lib/kit.js";
const N = 24;
const A = gradient(["#7ee787", "#79c0ff", "#d2a8ff", "#ff7b72", "#ffa657", "#7ee787"], N); // 0..23
const B = gradient(["#2f6b3a", "#2f557a", "#5a4a7a", "#7a3a36", "#7a5530", "#2f6b3a"], N); // 24..47
export const meta = {
slug: "zigzag-rule",
name: "Zigzag Rule",
category: "frames",
note: "A doubled zigzag rule that scrolls sideways while a rainbow gradient slides along it.",
tags: ["divider", "readme", "zigzag", "chevron", "separator"],
cols: 90, rows: 5, fps: 20,
palette: palette([...A, ...B]),
};
export default function create() {
const { cols } = meta;
const g = new Grid(cols, meta.rows);
const P = 8;
return (t) => {
g.clear();
const off = Math.floor(t * 6);
for (let x = 0; x < cols; x++) {
const u = (((x + off) % P) + P) % P;
const y = u < 4 ? 3 - u : u - 4;
const ch = u < 4 ? "╱" : "╲";
const ci = ((Math.floor((x - t * 14) / cols * N * 1.5) % N) + N) % N;
g.set(x, y, ch, KEYS[ci]);
g.set(x, y + 1, ch, KEYS[24 + ((ci + 3) % N)]);
// sparkle dots in the hollows of the chevrons
if (u === 0) g.set(x, 0, Math.sin(t * 3 + x) > 0.3 ? "•" : "·", KEYS[(ci + 6) % N]);
if (u === 4) g.set(x, 4, Math.cos(t * 3 + x) > 0.3 ? "•" : "·", KEYS[(ci + 12) % N]);
}
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.