返回代码动画案例库
交互创作 / SOURCE CASE

单文件像素法师动画

从像素网格、固定调色板、状态机到粒子池,完整约束一个可离线运行的 Canvas 动画。

来源标注模型Claude Opus 5.5
社区来源案例模型名来自原项目说明;本站负责整理展示,不将来源视频表述为 Fastgoing 实测。
原案例视频WATCH / SOURCE

视频由来源 CDN 按需加载,版权归原作者;Fastgoing 不托管视频文件,也不将来源视频表述为本站独立实测结果。

完整提示词COPY / ADAPT
Create a single self-contained HTML file that renders an animated pixel art wizard casting a spell, using vanilla JavaScript and Canvas 2D. No external assets, libraries, or network requests.

RENDERING
- Draw everything to an offscreen canvas at a fixed logical resolution of 128x96, then blit to a fullscreen display canvas scaled by the largest integer factor that fits the window, centered, with imageSmoothingEnabled = false and CSS image-rendering: pixelated.
- All drawing snaps to integer coordinates on the logical canvas. No sub-pixel positions, anti-aliasing, gradients, or shadowBlur.
- Fixed palette of ~24 hex colors: deep blues/purples for night sky, warm robe tones, 3-4 bright magic colors. Every pixel comes from this palette.

CHARACTER
- Build the wizard procedurally from filled rects and pixel runs, ~24x32 logical pixels: pointed hat with a bend, long beard, two-shade robe with darker outline, staff with a gem at the tip.
- Parameterize the pose (staff angle, arm raise, head tilt, robe sway). Animate parameters smoothly, then quantize to the pixel grid each frame so motion reads at an 8-12 fps pixel animation feel even though the loop runs at 60fps.

ANIMATION
- Looping state machine: IDLE (2-frame bob, beard sway) -> CHARGE (staff raises, gem flickers, sparks spiral inward) -> CAST (bright burst, projectile fires across the scene, 1-2 pixel screen shake) -> RECOVER (settle back). Ease pose parameters between keyframes.
- Pooled allocation-free particle system: preallocate and reuse. Sparks orbit the gem during CHARGE, explode outward on CAST, each particle stepping its palette index from white to magic color to dark before despawn. Snap particle positions to the grid when drawing.
- Fixed 60hz timestep update with rAF rendering. Zero object allocation inside the loop.

SCENE
- Minimal background: dark sky, a few twinkling 1px stars, moon, stone floor line. Character silhouette must read clearly.
- Subtle 1px rim light on the wizard from the gem, brightening during CHARGE and CAST.

QUALITY BAR
- Crisp pixels at any window size, seamless loop, stable 60fps, readable silhouette. Should look like a polished 16-bit sprite animation, not vector shapes scaled down.

复制后先替换产品、主题、时长和输出规格;涉及外部素材、音乐或服务时,请确认授权与费用。

PROVENANCE / 来源

来源明确,本站直接呈现。

本条由 Fastgoing 从 awesome-opus5-5-videos 精选整理。上游说明原视频和提示词权利仍归各创作者所有,因此这里保留原帖、作者和项目入口。

HOW TO USE

把来源案例,改成你自己的任务。

建议先补全

01主题与真实素材02时长、画幅与帧率03允许使用的技术栈04预览、验收与导出方式

状态说明

“社区来源案例”表示提示词与视频来自原作者公开分享。本站内播放只是内容呈现,不等于 Fastgoing 独立执行过模型或验证了生成过程。