lottie-bodymovin
它能做什么
这项技能讲解如何借助经典动画规则,让 Lottie 动画显得更自然。适合使用 After Effects 导出文件、并把它用于网页或应用中的动画师和网页开发者。
适用场景
- ✓当你从 After Effects 得到一个 Lottie 动画,但它显得僵硬或平淡时。
- ✓当你想为 Lottie 动画加入挤压、预备动作或缓动效果时。
- ✓当你想在网页中控制 Lottie 的播放时。
技能链接
https://github.com/calesthio/OpenMontage/blob/main/.agents/skills/lottie-bodymovin/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的 Lottie 标志动画看起来很僵硬。请告诉我,在导出前如何在 After Effects 中加入挤压和缓动效果。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能讲解如何在 After Effects 中设置关键帧和缓动,如何用表达式实现挤压效果,以及如何在代码中控制播放速度和片段。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Lottie Animation Principles
Implement all 12 Disney animation principles using Lottie (Bodymovin) for vector animations.
1. Squash and Stretch
In After Effects before export:
- Animate Scale X and Y inversely
- Use expression:
s = transform.scale[1]; [100 + (100-s), s]
// Control at runtime
lottie.setSpeed(1.5); // affect squash timing
2. Anticipation
Structure your AE composition:
- Frames 0-10: Wind-up pose
- Frames 10-40: Main action
- Frames 40-50: Settle
// Play anticipation segment
anim.playSegments([0, 10], true);
setTimeout(() => anim.playSegments([10, 50], true), 200);
3. Staging
// Layer multiple Lotties
<div className="scene">
<Lottie animationData={background} style={{ opacity: 0.6 }} />
<Lottie animationData={hero} style={{ zIndex: 10 }} />
</div>
4. Straight Ahead / Pose to Pose
Pose to pose in AE:
- Set keyframes at key poses
- Let AE interpolate between
- Use Easy Ease for smoothing
// Jump to specific poses
anim.goToAndStop(25, true); // frame 25
5. Follow Through and Overlapping Action
In After Effects:
- Offset child layer keyframes by 2-4 frames
- Use parenting with delayed expressions
thisComp.layer("Parent").transform.position.valueAtTime(time - 0.05)
6. Slow In and Slow Out
AE Keyframe settings:
- Select keyframes > Easy Ease (F9)
- Use Graph Editor to adjust curves
- Bezier handles control acceleration
// Adjust playback speed dynamically
anim.setSpeed(0.5); // slower
anim.setSpeed(2); // faster
7. Arc
In After Effects:
- Use motion paths (position property)
- Convert keyframes to Bezier
- Pull handles to create arcs
- Or use "Auto-Orient to Path"
8. Secondary Action
// Trigger secondary animation
mainAnim.addEventListener('complete', () => {
secondaryAnim.play();
});
// Or sync with frame
mainAnim.addEventListener('enterFrame', (e) => {
if (e.currentTime > 15) particleAnim.play();
});
9. Timing
anim.setSpeed(0.5); // half speed - dramatic
anim.setSpeed(1); // normal
anim.setSpeed(2); // double speed - snappy
// Or control frame rate in AE export
// 24fps = cinematic, 30fps = smooth, 60fps = fluid
10. Exaggeration
In After Effects:
- Push scale beyond 100% (120-150%)
- Overshoot rotation
- Use Overshoot expression
amp = 15; freq = 3; decay = 5; n = 0; time_start = key(1).time; if (time > time_start) { n = (time - time_start) / thisComp.frameDuration; amp * Math.sin(freq*n) / Math.exp(decay*n/100); } else { 0; }
11. Solid Drawing
In After Effects:
- Use 3D layers
- Apply perspective camera
- Animate Z position and rotation
- Use depth of field
12. Appeal
Design principles in AE:
- Smooth curves over sharp angles
- Consistent timing patterns
- Pleasing color palette
- Clean vector shapes
// React Lottie with hover
<Lottie
animationData={data}
onMouseEnter={() => anim.setDirection(1)}
onMouseLeave={() => anim.setDirection(-1)}
/>
Lottie Implementation
import Lottie from 'lottie-react';
import animationData from './animation.json';
<Lottie
animationData={animationData}
loop={true}
autoplay={true}
style={{ width: 200, height: 200 }}
/>
Key Lottie Features
playSegments([start, end])- Play frame rangesetSpeed(n)- Control timingsetDirection(1/-1)- Forward/reversegoToAndStop(frame)- Pose controladdEventListener- Frame events- Interactivity via
lottie-interactivity
常见问题
我需要 After Effects 吗?
很多步骤需要在导出前于 After Effects 中完成。
我能用代码控制动画吗?
可以。这项技能展示了如何更改速度、播放片段,以及跳转到指定帧。
它涵盖在同一场景中叠加多个动画吗?
涵盖。它展示了如何在一个场景中叠加多个 Lottie 动画,以营造层次感。
详情
作者的原始描述
Use when implementing Disney's 12 animation principles with Lottie animations exported from After Effects
repo: calesthio/OpenMontage
热度
- GitHub 星标
- 75k
- 排名
- #2669
- 许可证
- AGPL-3.0
- 更新时间
- 2026/10/28
评论
- …