← 返回
未分类 中文

Lottie

Lottie and dotLottie adapter patterns for HyperFrames. Use when embedding lottie-web JSON animations, .lottie files, @lottiefiles/dotlottie-web players, regi...
用于 HyperFrames 的 Lottie 与 dotLottie 适配器模式。适用于嵌入 lottie‑web JSON 动画、.lottie 文件、@lottiefiles/dotlottie‑web 播放器、注册...
lucas-kay8 lucas-kay8 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 243
下载
💾 0
安装
1
版本
#latest

概述

Lottie for HyperFrames

HyperFrames can seek both lottie-web and dotLottie players through its lottie runtime adapter. Lottie is a strong fit because the animation timeline is already encoded in the asset; HyperFrames only needs a player object it can seek.

Contract

  • Load assets from local project files, usually under assets/.
  • Set autoplay: false.
  • Prefer loop: false unless the user explicitly wants a loop.
  • Register every returned animation or player on window.__hfLottie.
  • Keep the Lottie container dimensions stable with CSS.

The adapter seeks lottie-web with goToAndStop(timeMs, false) and dotLottie with frame or percentage APIs depending on player shape.

lottie-web Pattern

<div id="logo-lottie" class="lottie-layer"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.12.2/lottie.min.js"></script>
<script>
  const anim = lottie.loadAnimation({
    container: document.getElementById("logo-lottie"),
    renderer: "svg",
    loop: false,
    autoplay: false,
    path: "assets/logo-reveal.json",
  });

  window.__hfLottie = window.__hfLottie || [];
  window.__hfLottie.push(anim);
</script>
.lottie-layer {
  width: 100%;
  height: 100%;
}

dotLottie Pattern

<canvas id="product-lottie" class="lottie-canvas"></canvas>
<script src="https://unpkg.com/@lottiefiles/dotlottie-web"></script>
<script>
  const player = new DotLottie({
    canvas: document.getElementById("product-lottie"),
    src: "assets/product-flow.lottie",
    autoplay: false,
    loop: false,
  });

  window.__hfLottie = window.__hfLottie || [];
  window.__hfLottie.push(player);
</script>
.lottie-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

Multiple Animations

Push each player into the same registry:

window.__hfLottie = window.__hfLottie || [];
window.__hfLottie.push(backgroundAnim);
window.__hfLottie.push(iconAnim);
window.__hfLottie.push(confettiAnim);

HyperFrames seeks them all to the same composition time.

Good Uses

  • After Effects exports that are already known to render correctly in lottie-web.
  • Logo reveals, icon loops, decorative accents, and product UI motion.
  • Translating Remotion Lottie usage into plain HyperFrames HTML.

Avoid

  • Relying on remote path URLs at render time.
  • Starting playback with play().
  • Assuming unsupported After Effects effects will survive export. Test the JSON or .lottie file in a browser first.
  • Loading a player asynchronously and registering it after HyperFrames validation has already inspected the page.

Validation

After editing a Lottie composition:

npx hyperframes lint
npx hyperframes validate

Credits And References

  • HyperFrames adapter source: packages/core/src/runtime/adapters/lottie.ts.
  • lottie-web by Airbnb: https://github.com/airbnb/lottie-web
  • lottie-web loadAnimation options: https://github.com/airbnb/lottie-web/wiki/loadAnimation-options
  • dotLottie web player methods by LottieFiles: https://developers.lottiefiles.com/docs/dotlottie-player/dotlottie-web/methods

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-23 16:54 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

design-media

UI/UX Pro Max

xobi667
提供 UI/UX 设计智能与实现指导,帮助打造精美界面。适用于 UI 设计、UX 流程、信息架构、视觉风格、设计系统/标记、组件规格、文案/微文案、无障碍及前端 UI(HTML/CSS/JS、React、Next.js、Vue、Svelte
★ 223 📥 48,398
design-media

Openai Whisper

steipete
使用 Whisper CLI 进行本地语音转文字(无需 API 密钥)
★ 333 📥 94,401
dev-programming

Gsap

lucas-kay8
GSAP 动画参考,适用于 HyperFrames。涵盖 gsap.to()、from()、fromTo()、缓动、stagger、默认值、时间线(gsap.timeline()、位置参数、标签...
★ 0 📥 667