tanbopiao

积微 jiwei

Community tanbopiao
Updated

积微——像素粒子特效引擎,独立重写,灵感致谢 patch-gg/pixelfx 与 Sprite Fusion

积微 jiwei

积微者速成,尽小者大 ——《荀子·大略》

像素粒子特效引擎:粒子积微成著,小特效聚成库。单文件、零依赖、纯浏览器 JS,IIFE 直接嵌入网页。

名字出处

「积微」取自《荀子·大略》:「积微者速成,尽小者大。」微小粒子的积累成就宏大画面,正如一个个小特效聚成一座库——与轻量化复刻「以小博大」的哲学同构。

用法

<script src="jiwei.js"></script>
<script>
  // 一行创建引擎(scale 为像素放大倍数)
  var eng = new Jiwei.Engine('campfire', { canvas: myCanvas, scale: 3, seed: 7 });

  // 游戏主循环里每帧调用
  function frame() { eng.tick(1 / 30); requestAnimationFrame(frame); }
  frame();

  // 换色板 / 镜像 / 换种子
  eng.setPalette(['#fff', '#f80', '#400']);
  eng.setMirror(true);
  eng.setSeed(42);
</script>

可用特效:campfire 篝火 / explosion 爆炸 / lightning 闪电 / frost-nova 冰霜新星 / heal-aura 治疗光环 / portal 传送门 / butterfly 蝴蝶 / rain 下雨 / coin-collect 金币收集 / chimney 烟囱 / fireflies 萤火虫 / glitch 屏幕故障。

打开 demo.html 即可网格预览全部特效,支持全局暂停、镜像、色相换色、重掷种子。

MCP stdio 服务

jiwei-mcp.mjs 提供零依赖 MCP 服务(JSON-RPC 2.0 over stdio,Node 18+),供任何 MCP 客户端无头调用:

node jiwei-mcp.mjs
工具 说明
list_effects 列出全部 12 个特效的元信息
describe_effect(id) 查看单个特效详情
simulate_frames(id, frames, seed, mirror, hue_shift) 画布桩无头跑帧,返回粒子数与耗时统计
hue_shift(hex, deg) 对单个颜色做色相旋转

适用边界:适合无头验证、元信息查询与换色方案;真实像素渲染仍需浏览器端 jiwei.js。

与上游的取舍对比

pixelfx(上游) jiwei(本项目)
体积 完整形态 27MB(含图片资源) 单文件约 30KB
特效数 244 首批 12
依赖 零运行时依赖(构建期 esbuild) 零依赖(含构建期)
表演编排 rig/act 完整动作系统(前摇/命中/恢复) 无,单特效独立循环
精灵图导出 支持 sprite sheet 导出 无
Claude 技能 附带生成技能 无

如实边界:jiwei 不含上游的动作编排层(acting)、精灵图导出与角色骨骼系统;特效为独立循环粒子动画,不支持上游的「十二连招」链式演出。色相换色为整体色相旋转,非上游的逐色板精调。

致谢

本项目为独立重写、无代码血缘:未复制上游任何代码,仅参考其功能形态与参数化思路,全部代码从零编写。

许可证

MIT License,见 LICENSE。

MCP Client Configuration

Published on npm as @zongyuanroot/jiwei. For MCP clients (Cline, Cherry Studio, Cursor, etc.):

{
  "mcpServers": {
    "jiwei": {
      "command": "npx",
      "args": ["-y", "@zongyuanroot/jiwei"]
    }
  }
}

MCP Server · Populars

MCP Server · New

    atilaahmettaner

    TradingMCP: Market Data & Technical Analysis for AI Assistants

    MCP server for market analysis in AI assistants: screeners, multi-timeframe technical analysis, backtests and sentiment for crypto, stocks, forex and futures. 39 tools. Self-host free, or use the hosted version, TradingMCP.

    Community atilaahmettaner
    lifan-builds

    Faster Mac Use (fmu)

    Background-first, multi-cursor browser and native macOS computer-use engine for AI agents

    Community lifan-builds
    agent360dev

    Agent360 Browser MCP

    The browser tool that can stop and ask you. A 2FA code, a CAPTCHA, a choice only you can make: it asks on your screen, then carries on in the same signed-in Chrome. 41 tools, MCP clients that run local servers, MIT.

    Community agent360dev
    robinAKL

    Agent Room

    Put Claude Code, Cursor, Codex, Gemini & Antigravity in one room — real-time multi-agent AI collaboration over MCP for distributed dev, code review, PR handoff & frontend↔backend integration. Free, self-hostable, MCP-native.

    Community robinAKL
    blen-labs

    Capture MCP

    AI-native Model Context Protocol (MCP) server that integrates SAM.gov, USASpending.gov, and Tango APIs to capture and analyze federal procurement and spending data through natural language queries. Responses include both human-readable text and structured JSON so MCP-compatible clients can consume the data programmatically.

    Community blen-labs