算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
create-glyph【设计与创意】Create R-based pictogram glyphs for skill, agent, or team icons in the visualization layer. Covers concept sketching, ggplot2 layer composition using the primitives library, color strategy, registration in the appropriate glyph mapping file and manifest, rendering via the build pipeline, and visual verification of the neon-glow output. Use when a new…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Make R-based pictogram glyphs for skill, agent, or team icons in viz/ visualization layer. Each glyph is pure-ggplot2 function. Draws recognizable shape on 100x100 canvas. Rendered with neon glow to transparent-background WebP.
skill, agent, or teamcreate-glyph, mystic, r-package-review) and domain (for skills)--glow-sigma value (default: 4)Identify entity being iconified. Pick visual metaphor.
skills/<id>/SKILL.mdagents/<id>.mdteams/<id>.mdComplexity Tiers:
+----------+--------+-------------------------------------------+
| Tier | Layers | Examples |
+----------+--------+-------------------------------------------+
| Simple | 2 | glyph_flame, glyph_heartbeat |
| Moderate | 3-5 | glyph_document, glyph_experiment_flask |
| Complex | 6+ | glyph_ship_wheel, glyph_bridge_cpp |
+----------+--------+-------------------------------------------+
glyph_<descriptive_name> (snake_case, unique)Got: Clear mental sketch of shape with 2-6 planned layers.
If fail: Concept too abstract? Fall back to related concrete object. Review existing glyphs in same domain for inspiration.
Write R function producing ggplot2 layers.
Function signature (immutable contract):
glyph_<name> <- function(cx, cy, s, col, bright) {
# cx, cy = center coordinates (50, 50 on 100x100 canvas)
# s = scale factor (1.0 = fill ~70% of canvas)
# col = domain color hex (e.g., "#ff88dd" for design)
# bright = brightened variant of col (auto-computed by renderer)
# Returns: list() of ggplot2 layers
}
Apply scale factor * s to ALL dimensions for consistent scaling:
r <- 20 * s # radius
hw <- 15 * s # half-width
lw <- .lw(s) # line width (default base 2.5)
lw_thin <- .lw(s, 1.2) # thinner line width
Build geometry using available primitives:
| Geometry | Usage |
|---|---|
ggplot2::geom_polygon(data, .aes(x, y), ...) | Filled shapes |
ggplot2::geom_path(data, .aes(x, y), ...) | Open lines/curves |
ggplot2::geom_segment(data, .aes(x, xend, y, yend), ...) | Line segments, arrows |
ggplot2::geom_rect(data, .aes(xmin, xmax, ymin, ymax), ...) | Rectangles |
ggforce::geom_circle(data, .aes(x0, y0, r), ...) | Circles |
Apply color strategy:
Alpha Guide:
+----------------------+------------+--------------------------+
| Purpose | Alpha | Example |
+----------------------+------------+--------------------------+
| Large fill (body) | 0.08-0.15 | hex_with_alpha(col, 0.1) |
| Medium fill (accent) | 0.15-0.25 | hex_with_alpha(col, 0.2) |
| Small fill (detail) | 0.25-0.35 | hex_with_alpha(bright, 0.3) |
| Outline stroke | 1.0 | color = bright |
| Secondary stroke | 1.0 | color = col |
| No fill | --- | fill = NA |
+----------------------+------------+--------------------------+
Return flat list() of layers. Renderer iterates and wraps each with glow.
Place function in right primitives file by entity type:
primitives.R — bushcraft, compliance, containerization, data-serialization, defensiveprimitives_2.R — devops, general, git, mcp-integrationprimitives_3.R — mlops, observability, PM, r-packages, reporting, review, web-dev, esoteric, designprimitives_4.R through primitives_19.R for newer domainsviz/R/agent_primitives.Rviz/R/team_primitives.RGot: Working R function returning list of 2-6 ggplot2 layers.
If fail: ggforce::geom_circle errors? Confirm ggforce installed. Coords off? Canvas is 100x100 with (0,0) at bottom-left. Test function interactively:
source("viz/R/utils.R"); source("viz/R/primitives.R") # etc.
layers <- glyph_<name>(50, 50, 1.0, "#ff88dd", "#ffa8f0")
p <- ggplot2::ggplot() + ggplot2::coord_fixed(xlim=c(0,100), ylim=c(0,100)) +
ggplot2::theme_void()
for (l in layers) p <- p + l
print(p)
Add entity-to-glyph mapping in right glyph mapping file.
For skills:
viz/R/glyphs.R# -- design (3))"skill-id" = "glyph_function_name",
For agents:
viz/R/agent_glyphs.RAGENT_GLYPHS"agent-id" = "glyph_function_name",
For teams:
Open viz/R/team_glyphs.R
Find alphabetical position in TEAM_GLYPHS
Add entry:
"team-id" = "glyph_function_name",
Verify no duplicate ID exists in target list
Got: Right *_GLYPHS list has new mapping.
If fail: Build later reports "No glyph mapped"? Double-check entity ID exactly matches one in manifest and registry.
Register icon in right manifest file.
For skills: viz/data/icon-manifest.json
{
"skillId": "skill-id",
"domain": "domain-name",
"prompt": "<domain basePrompt>, <descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/<domain>/<skill-id>.webp",
"status": "pending"
}
For agents: viz/data/agent-icon-manifest.json
{
"agentId": "agent-id",
"prompt": "<agent-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/agents/<agent-id>.webp",
"status": "pending"
}
For teams: viz/data/team-icon-manifest.json
{
"teamId": "team-id",
"prompt": "<team-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/teams/<team-id>.webp",
"status": "pending"
}
Got: Valid JSON with new entry placed among type siblings.
If fail: Validate JSON syntax. Common mistakes: trailing comma after last array element, missing quotes.
Run icon pipeline to render new glyph. Always use build.sh as entry point — it handles platform detection and R binary selection. See render-icon-pipeline for full flag reference and pipeline architecture.
# From project root — renders all palettes, standard + HD, skips existing icons
bash viz/build.sh --only <domain> --skip-existing # skills
bash viz/build.sh --type agent --only <id> --skip-existing # agents
bash viz/build.sh --type team --only <id> --skip-existing # teams
# Dry run first:
bash viz/build.sh --only <domain> --dry-run
build.sh runs full pipeline (palette → data → manifest → render → terminal glyphs). Non-render steps add ~10 seconds but keep all data current.
Output locations:
viz/public/icons/<palette>/<domain>/<skill-id>.webpviz/public/icons/<palette>/agents/<agent-id>.webpviz/public/icons/<palette>/teams/<team-id>.webpGot: Log shows OK: <entity> (seed=XXXXX, XX.XKB). WebP file exists.
If fail:
"No glyph mapped" — Step 3 mapping missing or typo"Unknown domain" — Domain not in get_palette_colors() in palettes.Rinstall.packages(c("ggplot2", "ggforce", "ggfx", "ragg", "magick")) firstCheck rendered output meets quality standards.
Verify file exists and has reasonable size:
ls -la viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Expected: 15-80 KB typical range
Open WebP in image viewer. Check:
Check at small sizes (icon renders at ~40-160px in force graph):
Got: Clear, recognizable pictogram with even neon glow on transparent background.
If fail:
--glow-sigma 2 (default is 4)--glow-sigma 8.lw(s, base) base value)Adjust and re-render.
Common adjustments:
.lw(s, base) — try base = 3.0 or 3.5s (e.g., 20 * s -> 24 * s)Re-render after changes:
# Delete the existing icon first, then re-render
rm viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Use the appropriate build command from Step 5
Satisfied? Verify manifest status shows "done". Build script updates it on success.
Got: Final icon passes all verification checks from Step 6.
If fail: After 3+ iterations glyph still reads poorly? Consider completely different visual metaphor (back to Step 1).
All domain colors (for skills) in viz/R/palettes.R (single source of truth). Agent and team colors also in palettes.R. Cyberpunk palette (hand-tuned neon colors) in get_cyberpunk_colors(). Viridis-family palettes auto-generated via viridisLite.
Look up color:
source("viz/R/palettes.R")
get_palette_colors("cyberpunk")$domains[["design"]] # skill domain
get_palette_colors("cyberpunk")$agents[["mystic"]] # agent
get_palette_colors("cyberpunk")$teams[["tending"]] # team
Adding new domain? Add to three places in palettes.R:
PALETTE_DOMAIN_ORDER (alphabetical)get_cyberpunk_colors() domains listbash viz/build.sh to regenerate palettes, data, manifestsSee full catalog of available glyph functions in primitives source files:
viz/R/primitives.R through viz/R/primitives_19.R (domain-grouped)viz/R/agent_primitives.Rviz/R/team_primitives.R| Function | Signature | Purpose |
|---|---|---|
.lw(s, base) | (scale, base=2.5) | Scale-aware line width |
.aes(...) | alias for ggplot2::aes | Shorthand aesthetic mapping |
hex_with_alpha(hex, alpha) | (string, 0-1) | Add alpha to hex color |
brighten_hex(hex, factor) | (string, factor=1.3) | Brighten a hex color |
dim_hex(hex, factor) | (string, factor=0.4) | Dim a hex color |
glyph_<name>(cx, cy, s, col, bright) -> list() signature* s scaling factorcol for fills, bright for outlines, hex_with_alpha() for transparency*_glyphs.R file"status": "pending""done" after successful render* s: Hard-coded pixel values break when scale changes. Always multiply by s.y values move UP.ggfx::with_outer_glow() to every layer. Do NOT add glow inside glyph function.get_cyberpunk_colors() in palettes.R? Rendering errors. Add color first, then regenerate.primitives*.R, agents in agent_primitives.R, teams in team_primitives.R.enhance-glyph — improve existing glyph's visual quality, fix rendering issues, add detail layersaudit-icon-pipeline — detect missing glyphs and icons, know what needs creatingrender-icon-pipeline — run full rendering pipeline end-to-endornament-style-mono — complementary AI-based image generation (Z-Image vs R-coded glyphs)ornament-style-color — color theory for glyph accent fill decisionscreate-skill — parent workflow triggering glyph creation when adding new skills