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/easing.py

View on GitHub
"""easing.py — standard easing functions for effect animation.

Each takes a progress ratio t in [0,1] and returns an eased value (usually in
[0,1], though back/elastic overshoot outside it by design). These are the
canonical Penner/Robert-Penner easings used everywhere from CSS to game engines
and terminaltexteffects; text effects use them to move characters from a start
to a target position with natural acceleration instead of a linear slide.

Shared so effects don't each re-derive the math. Pure stdlib.
"""
from __future__ import annotations

import math

_C1 = 1.70158            # back-easing overshoot constant
_C2 = _C1 * 1.525
_C3 = _C1 + 1.0
_C4 = (2 * math.pi) / 3
_C5 = (2 * math.pi) / 4.5


def _clamp01(t: float) -> float:
    return 0.0 if t < 0 else (1.0 if t > 1 else t)


def linear(t): return _clamp01(t)


def in_quad(t): t = _clamp01(t); return t * t
def out_quad(t): t = _clamp01(t); return 1 - (1 - t) * (1 - t)
def in_out_quad(t):
    t = _clamp01(t)
    return 2 * t * t if t < 0.5 else 1 - (-2 * t + 2) ** 2 / 2


def in_cubic(t): t = _clamp01(t); return t ** 3
def out_cubic(t): t = _clamp01(t); return 1 - (1 - t) ** 3
def in_out_cubic(t):
    t = _clamp01(t)
    return 4 * t ** 3 if t < 0.5 else 1 - (-2 * t + 2) ** 3 / 2


def in_sine(t): t = _clamp01(t); return 1 - math.cos(t * math.pi / 2)
def out_sine(t): t = _clamp01(t); return math.sin(t * math.pi / 2)
def in_out_sine(t): t = _clamp01(t); return -(math.cos(math.pi * t) - 1) / 2


def out_back(t):
    t = _clamp01(t)
    return 1 + _C3 * (t - 1) ** 3 + _C1 * (t - 1) ** 2


def in_out_back(t):
    t = _clamp01(t)
    if t < 0.5:
        return ((2 * t) ** 2 * ((_C2 + 1) * 2 * t - _C2)) / 2
    return ((2 * t - 2) ** 2 * ((_C2 + 1) * (t * 2 - 2) + _C2) + 2) / 2


def out_elastic(t):
    t = _clamp01(t)
    if t == 0 or t == 1:
        return t
    return 2 ** (-10 * t) * math.sin((t * 10 - 0.75) * _C4) + 1


def out_bounce(t):
    t = _clamp01(t)
    n1, d1 = 7.5625, 2.75
    if t < 1 / d1:
        return n1 * t * t
    if t < 2 / d1:
        t -= 1.5 / d1
        return n1 * t * t + 0.75
    if t < 2.5 / d1:
        t -= 2.25 / d1
        return n1 * t * t + 0.9375
    t -= 2.625 / d1
    return n1 * t * t + 0.984375


# name -> function, for effects that take an easing by string param.
EASINGS = {
    "linear": linear,
    "in_quad": in_quad, "out_quad": out_quad, "in_out_quad": in_out_quad,
    "in_cubic": in_cubic, "out_cubic": out_cubic, "in_out_cubic": in_out_cubic,
    "in_sine": in_sine, "out_sine": out_sine, "in_out_sine": in_out_sine,
    "out_back": out_back, "in_out_back": in_out_back,
    "out_elastic": out_elastic, "out_bounce": out_bounce,
}


def get(name: str):
    """Look up an easing by name, defaulting to in_out_cubic."""
    return EASINGS.get(name, in_out_cubic)
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