mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-22 04:50:29 +08:00
Translated 85 skill sub-reference files to achieve full parity with the English source: - skills/angular-developer/references/ — 35 files (all references) - skills/remotion-video-creation/rules/ — 28 files (all rules) - skills/tinystruct-patterns/references/ — 5 files - skills/openclaw-persona-forge/references/ — 6 files - skills/skill-comply/prompts/ — 3 files - skills/lead-intelligence/agents/ — 4 files - skills/brand-voice/references/ — 1 file - skills/frontend-slides/ — 2 files - hooks/memory-persistence/README.md — 1 file English source parity: 0 missing files (excluding rules/zh/, internal docs, and experimental examples absent from zh-CN)
68 lines
2.1 KiB
Markdown
68 lines
2.1 KiB
Markdown
---
|
||
name: lottie
|
||
description: RemotionにLottieアニメーションを埋め込む。
|
||
metadata:
|
||
category: Animation
|
||
---
|
||
|
||
# RemotionでLottieアニメーションを使用する
|
||
|
||
## 前提条件
|
||
|
||
まず、@remotion/lottieパッケージをインストールする必要があります。
|
||
インストールされていない場合は、以下のコマンドを使用します:
|
||
|
||
```bash
|
||
npx remotion add @remotion/lottie # npmを使うプロジェクト
|
||
bunx remotion add @remotion/lottie # bunを使うプロジェクト
|
||
yarn remotion add @remotion/lottie # yarnを使うプロジェクト
|
||
pnpm exec remotion add @remotion/lottie # pnpmを使うプロジェクト
|
||
```
|
||
|
||
## Lottieファイルの表示
|
||
|
||
Lottieアニメーションをインポートするには:
|
||
|
||
- Lottieアセットをフェッチする
|
||
- 読み込みプロセスを `delayRender()` と `continueRender()` でラップする
|
||
- アニメーションデータをstateに保存する
|
||
- `@remotion/lottie` パッケージの `Lottie` コンポーネントを使ってLottieアニメーションをレンダリングする
|
||
|
||
```tsx
|
||
import {Lottie, LottieAnimationData} from '@remotion/lottie';
|
||
import {useEffect, useState} from 'react';
|
||
import {cancelRender, continueRender, delayRender} from 'remotion';
|
||
|
||
export const MyAnimation = () => {
|
||
const [handle] = useState(() => delayRender('Loading Lottie animation'));
|
||
|
||
const [animationData, setAnimationData] = useState<LottieAnimationData | null>(null);
|
||
|
||
useEffect(() => {
|
||
fetch('https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json')
|
||
.then((data) => data.json())
|
||
.then((json) => {
|
||
setAnimationData(json);
|
||
continueRender(handle);
|
||
})
|
||
.catch((err) => {
|
||
cancelRender(err);
|
||
});
|
||
}, [handle]);
|
||
|
||
if (!animationData) {
|
||
return null;
|
||
}
|
||
|
||
return <Lottie animationData={animationData} />;
|
||
};
|
||
```
|
||
|
||
## スタイリングとアニメーション
|
||
|
||
Lottieはスタイルとアニメーションを適用するための `style` プロパティをサポートしています:
|
||
|
||
```tsx
|
||
return <Lottie animationData={animationData} style={{width: 400, height: 400}} />;
|
||
```
|