Communitygithub.com

循环封面

将新闻通讯或博客封面转换为无缝循环的GIF(896 x 640,180帧,20fps)。只有您指定的一个元素运动,循环经过旋转以使第1帧呈现完成画面,接缝通过测量而非目测确定。

循环封面 是什么?

此技能旨在将静态封面(PNG或HTML构建的896×640图像)自动转换为一个高质量的无缝循环GIF动画,用于动态展示在满是静止图片的信息流中。其核心创新在于仅让用户指定的单一元素运动,并通过算法将循环旋转,使得第一帧即为完整封面图,从而在邮件预览或链接卡片中仍能显示完整静态封面。支持基于HTML的封面(纯时间函数动画)和基于图像的封面(按颜色掩码精确控制像素变化),动画采用单一正弦周期或绘制-保持-淡出模式确保首尾帧无缝衔接(接缝值目标0.0-0.3)。工具链包括使用FFmpeg进行无抖动的调色板编码,并内置测量脚本输出帧数、接缝差异和画面位移量,参考已交付作品的经验数据。该技能适用于Claude Code、Cursor、Codex等AI代理平台,适合需要提升封面视觉吸引力的内容创作者。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/charlie947/motion-graphics-skills/tree/main/skills/loop-cover

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

循环封面 GIF

在满是静止图片的信息流中,一张会动的封面更容易被注意到。但前提是:运动幅度要小,循环不能跳跃,且第一帧本身仍能独立传达完整信息。

开始之前: 查看是否存在 brand.md 和 MOTION.md。如果不存在,请先运行 brand-intake,或者索要十六进制色码、字体和 Logo 文件。未经这些步骤,切勿声称结果符合品牌要求。

步骤 1:索要三样东西,然后等待

  1. 封面。 一张完成的静态图片(PNG)或用 HTML 构建的封面。尺寸为 896 x 640,或者具有相同 7:5 比例的大图。
  2. 唯一运动的元素, 用直白的语言命名。例如“灯塔的光束”“橙色线条自动绘制”“单元格之间的线条”。
  3. 它的运动方式。 脉冲、绘制、缓慢漂移或发光。只选一种运动,不是三种。

步骤 2:构建

如果封面是 HTML: 仅将命名元素作为纯时间函数进行动画处理,添加 window.seek(seconds),并以 20fps(9 秒)捕获 180 帧。

如果封面是图片: 在代码中对静态图像进行动画处理。按颜色制作命名元素的遮罩(例如,所有蓝色远强于红色的像素),将其边缘软化几个像素,并逐帧仅更改那些像素。遮罩外的任何内容都不移动。

对于两种情况,均在 9 秒内使用一个干净的正弦周期或一个“绘制-保持-淡出”模式,使得最后一帧平稳过渡到第一帧。

旋转循环,使第 1 帧呈现完成画面。 收件箱和链接预览会将第 1 帧显示为静态图片。第 i 帧绘制的是时刻 ((i + offset) mod 180) / 20 秒,其中 offset 将完全绘制状态放在最前面。

编码时不使用抖动,因为抖动会在平面图像的每一帧上增加闪烁:

ffmpeg -y -framerate 20 -i f%03d.png -filter_complex "split[x][y];[x]palettegen=max_colors=128:stats_mode=full[p];[y][p]paletteuse=dither=none" -loop 0 cover.gif

步骤 3:测量

ffmpeg -v error -y -i cover.gif -vf scale=216:154,format=gray -f rawvideo frames.raw
python3 -c "
n = 216 * 154
d = open('frames.raw', 'rb').read()
f = [d[i:i + n] for i in range(0, len(d), n)]
diff = lambda a, b: sum(abs(x - y) for x, y in zip(a, b)) / n
print('frames', len(f))
print('seam', round(diff(f[-1], f[0]), 2))
print('excursion', round(max(diff(x, f[0]) for x in f), 2))
"

从我交付的封面的目标值:180 帧、接缝值 0.0 到 0.3、位移量约 0.7 到 2.8、文件大小在 0.6 到 2.3 MB 之间。位移量接近零意味着没有可见的运动。

我走过的弯路

  • “你完全改变了画面。” 我的第一个 GIF 在整个画面上扫过一个色带。只应动画化被命名的元素。
  • 视频模型会添加摄像机运动。 尽管要求“摄像机完全静止”,它还是推进了。在代码中对静态图像进行动画是锁定摄像机的唯一方法。
  • 永远不要在半帧处测量运动。 正弦波在那里回到零点,因此一个工作的动画会报告没有运动。测量相对于第 0 帧的最大变化。
  • 在 ffmpeg 的 eq 过滤器中添加 eval=frame, 否则表达式只运行一次,没有任何东西移动。
  • 缩小到 240 像素宽再检查一遍。 这是收件箱中的尺寸。如果运动元素消失,说明它太小了。
  • 上传 GIF 本身。 某些上传工具会将其转换为 PNG,动画会悄然丢失。检查上传的链接是否仍以 .gif 结尾。

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

animated-chart

Make a looping animated chart for LinkedIn or a newsletter in code with Claude Code. Bars that become a line, a number that counts up, a before and after. Every value stays exactly as given. Use when someone says

apple-launch-film

Rebuild an Apple-style Mac launch film entirely in code with Claude Code. A thin menu bar, the black notch growing into widgets one scene at a time, full-screen gradient wallpapers and one short caption per scene. No screen recording, no After Effects. Use when someone says

brand-intake

The setup step every other skill in this pack reads. A short interview plus 3 to 5 reference frames becomes two files in your project, brand.md (who you are, what you sell, your assets) and MOTION.md (your colours, type, timing and motion rules), plus a rule in CLAUDE.md so Claude reads them before it animates anything. Use at the start of any motion project, or when someone says

launch-video

Make a 30-45 second product launch video in code with Claude Code, the kind SaaS companies post on launch day. One sentence split across scenes, real product screens with slow camera moves, a typed prompt, a proof beat and a clear call to action. Use when someone says

milestone-reveal

Make a 12-second looping milestone clip in code with Claude Code. Thousands of tiny points drift like a night sky, pull together into your real number (followers, subscribers, revenue, customers), a line draws underneath and the label settles in. Premium, not a party. Use when someone says

model-showdown

Give the same motion brief to three AI models, keep each first try, render all three the same way and stack them into one comparison video with model names and logos. Makes a 16:9 side-by-side for a newsletter and a 1080 x 1920 stacked reel for Instagram and TikTok. Use when someone says

motion-brief-writer

Turns a rough idea for an animated graphic into a precise build brief for Claude Code, in your own brand. Asks for anything essential first (exact numbers, size, length, brand), keeps real results apart from sample data, and never invents a figure. Use when someone says

motion-effects

Build any of 16 premium motion effects from scratch in your own brand, as one 8-second looping HTML file with window.seek(seconds) so it exports frame-exact to MP4 or GIF. Interfaces (button to player, search to results, card to workspace, tabs to panels), data (chart morph, dashboard zoom, spring stack, magnetic dock), type (masked type, elastic type, text to layout, image reveal) and systems (perspective shift, glass focus, flowing paths, particle logo). Use when someone says

motion-prompt-writer

Write a complete 8-part Claude Motion prompt (The bar, Format, The one rule, Look, Motion, Never, Before you finish, The scene) for one short looping motion graphic, in your own brand. Takes your brand (a website screenshot, a logo, hex codes, or nothing for the Apple-style default) and one moment you want to show, in plain words. Use when someone says

newsletter-promo

Turn a newsletter edition into a 12-20 second promo clip for LinkedIn, Instagram or X that drives people to read and subscribe. Hook question, three proof frames from the edition, then the newsletter name and where to read it. Use when someone says

reel-export

Turn any horizontal or square motion video into a 1080 x 1920 Instagram Reel or TikTok that uploads cleanly. Headline and logos inside the safe zone, H.264, yuv420p, limited colour range, bt709, a silent audio track when there is no sound, and an ffprobe check before upload. Use when someone says

reference-to-motion

Turn references you admire into a scene-by-scene Claude Motion prompt for your own topic and brand. Takes a video for the moves (screenshots, frames or a contact sheet of a reel or ad) and, optionally, a look reference for the style (a website, a brand, a moodboard). Use when someone says

title-sequence-3d

Make a cinematic 3D title sequence (8-15 seconds) in code with Claude Code and Three.js. A camera moves through a lit scene, such as a rainy street at night with brand names as neon signs, then a big question or title lands. Use when someone wants a scroll-stopping opener, a film-style intro,

vox-explainer

Make a short Vox-style documentary explainer (30-60 seconds) entirely in code with Claude Code. Torn paper, halftone texture, bold condensed type, motion on twos. Use when someone says

相关技能