Skip to content

dwgx/SmartCLI / skills/cmd-art

cmd-art

Verified

Design and render terminal/CMD visual effects and ASCII art from a one-line request via the pluggable `fx` engine (30 effects, hot-swappable and themeable, plus scripted shows). Effects include donut, matrix rain, plasma, fire, a spinning 3D ball, a solar-system orrery, Game of Life, wireframe cube, 3D text banners, rainbow/lolcat gradient text, starfield, tunnel, fireworks, image-to-ASCII, and more. Use when the request is for a terminal animation, ANSI/CLI art, or a new console effect. Pure Python stdlib; truecolor.

fx/effects/decrypt.py

View on GitHub
"""Movie-style decrypt reveal: glyph noise resolves into the real text.

Per char: ``start = i*stagger + jitter``, ``lock = start + scramble``. Before
start -> blank; before lock -> random cipher glyph (refreshed every few
frames, colored theme base/accent); after -> final char in theme.primary.
Source: research/R1 part D.1 (GSAP ScrambleText / TTE Decrypt).
"""
from __future__ import annotations

import random

from ..core import RESET, rgb
from ..base import Effect, FrameCtx, Param
from ..registry import register

GLYPHS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&*+-/<>?[]{}"


@register
class Decrypt(Effect):
    name = "decrypt"
    description = "Scramble-to-plaintext reveal (per-char start/lock schedule)."
    tags = ("text", "reveal", "matrix")
    preferred_theme = "matrix-green"
    default_fps = 20.0
    params = (
        Param("text", "str", "ACCESS GRANTED: SMARTCLI ONLINE",
              "text to reveal (use \\n for line breaks)"),
        Param("stagger", "float", 0.06, "seconds between char starts", min=0.0, max=1.0),
        Param("scramble", "float", 0.9, "avg scramble duration seconds", min=0.05, max=5.0),
        Param("seed", "int", 7, "RNG seed for the schedule"),
    )

    def setup(self) -> None:
        self._sched = None
        self._scratch = {}

    def _schedule(self, text, p):
        if self._sched is None:
            rng = random.Random(p["seed"])
            sched = []
            for i, ch in enumerate(text):
                start = 0.2 + i * p["stagger"] + rng.uniform(0, p["stagger"] * 2)
                lock = start + rng.uniform(p["scramble"] * 0.5, p["scramble"] * 1.5)
                sched.append((start, lock))
            self._sched = sched
        return self._sched

    def render(self, ctx: FrameCtx) -> str:
        p = ctx.params
        text = p["text"].replace("\\n", "\n")
        sched = self._schedule(text, p)
        theme = ctx.theme
        ink = rgb(*theme.primary)
        dim = rgb(*theme.color_at(0.45))
        refresh = ctx.frame_index // 3  # mutate cipher glyphs every 3 frames

        # center the block
        lines = text.split("\n")
        top = max(0, (ctx.height - len(lines)) // 2)
        rows = [""] * ctx.height
        idx = 0
        for li, line in enumerate(lines):
            y = top + li
            left = max(0, (ctx.width - len(line)) // 2)
            buf = [" " * left]
            for ch in line:
                start, lock = sched[idx]
                if ch == " " or ctx.t >= lock:
                    buf.append(ink + ch)
                elif ctx.t >= start:
                    key = (idx, refresh)
                    g = self._scratch.get(key)
                    if g is None:
                        if len(self._scratch) > 4096:  # drop stale refresh keys
                            self._scratch.clear()
                        g = random.choice(GLYPHS)
                        self._scratch[key] = g
                    buf.append(dim + g)
                else:
                    buf.append(" ")
                idx += 1
            idx += 1  # the newline itself
            if 0 <= y < ctx.height:
                rows[y] = "".join(buf) + RESET
        return "\n".join(rows)

    def teardown(self) -> None:
        self._sched = None
        self._scratch = {}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 321kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall