mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-14 20:21:23 +08:00
174e31b3fc
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)
147 lines
3.8 KiB
Markdown
147 lines
3.8 KiB
Markdown
---
|
|
name: compositions
|
|
description: コンポジション、スティル、フォルダー、デフォルトプロップ、動的メタデータの定義
|
|
metadata:
|
|
tags: composition, still, folder, props, metadata
|
|
---
|
|
|
|
`<Composition>` はレンダリング可能な動画のコンポーネント、幅、高さ、fps、デュレーションを定義します。
|
|
|
|
通常、`src/Root.tsx` ファイルに配置されます。
|
|
|
|
```tsx
|
|
import { Composition } from "remotion";
|
|
import { MyComposition } from "./MyComposition";
|
|
|
|
export const RemotionRoot = () => {
|
|
return (
|
|
<Composition
|
|
id="MyComposition"
|
|
component={MyComposition}
|
|
durationInFrames={100}
|
|
fps={30}
|
|
width={1080}
|
|
height={1080}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
## デフォルトプロップ
|
|
|
|
コンポーネントの初期値を提供するために `defaultProps` を渡します。
|
|
値はJSONシリアライズ可能である必要があります(`Date`、`Map`、`Set`、`staticFile()` はサポートされています)。
|
|
|
|
```tsx
|
|
import { Composition } from "remotion";
|
|
import { MyComposition, MyCompositionProps } from "./MyComposition";
|
|
|
|
export const RemotionRoot = () => {
|
|
return (
|
|
<Composition
|
|
id="MyComposition"
|
|
component={MyComposition}
|
|
durationInFrames={100}
|
|
fps={30}
|
|
width={1080}
|
|
height={1080}
|
|
defaultProps={{
|
|
title: "Hello World",
|
|
color: "#ff0000",
|
|
} satisfies MyCompositionProps}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
`defaultProps` の型安全性を確保するために、`interface` ではなく `type` 宣言をプロップに使用してください。
|
|
|
|
## フォルダー
|
|
|
|
サイドバーでコンポジションを整理するために `<Folder>` を使用します。
|
|
フォルダー名には文字、数字、ハイフンのみ使用できます。
|
|
|
|
```tsx
|
|
import { Composition, Folder } from "remotion";
|
|
|
|
export const RemotionRoot = () => {
|
|
return (
|
|
<>
|
|
<Folder name="Marketing">
|
|
<Composition id="Promo" /* ... */ />
|
|
<Composition id="Ad" /* ... */ />
|
|
</Folder>
|
|
<Folder name="Social">
|
|
<Folder name="Instagram">
|
|
<Composition id="Story" /* ... */ />
|
|
<Composition id="Reel" /* ... */ />
|
|
</Folder>
|
|
</Folder>
|
|
</>
|
|
);
|
|
};
|
|
```
|
|
|
|
## スティル
|
|
|
|
単一フレーム画像には `<Still>` を使用します。`durationInFrames` や `fps` は不要です。
|
|
|
|
```tsx
|
|
import { Still } from "remotion";
|
|
import { Thumbnail } from "./Thumbnail";
|
|
|
|
export const RemotionRoot = () => {
|
|
return (
|
|
<Still
|
|
id="Thumbnail"
|
|
component={Thumbnail}
|
|
width={1280}
|
|
height={720}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
## メタデータの計算
|
|
|
|
`calculateMetadata` を使用して、データに基づいて寸法、デュレーション、プロップを動的にします。
|
|
|
|
```tsx
|
|
import { Composition, CalculateMetadataFunction } from "remotion";
|
|
import { MyComposition, MyCompositionProps } from "./MyComposition";
|
|
|
|
const calculateMetadata: CalculateMetadataFunction<MyCompositionProps> = async ({
|
|
props,
|
|
abortSignal,
|
|
}) => {
|
|
const data = await fetch(`https://api.example.com/video/${props.videoId}`, {
|
|
signal: abortSignal,
|
|
}).then((res) => res.json());
|
|
|
|
return {
|
|
durationInFrames: Math.ceil(data.duration * 30),
|
|
props: {
|
|
...props,
|
|
videoUrl: data.url,
|
|
},
|
|
};
|
|
};
|
|
|
|
export const RemotionRoot = () => {
|
|
return (
|
|
<Composition
|
|
id="MyComposition"
|
|
component={MyComposition}
|
|
durationInFrames={100} // プレースホルダー、上書きされる
|
|
fps={30}
|
|
width={1080}
|
|
height={1080}
|
|
defaultProps={{ videoId: "abc123" }}
|
|
calculateMetadata={calculateMetadata}
|
|
/>
|
|
);
|
|
};
|
|
```
|
|
|
|
この関数は `props`、`durationInFrames`、`width`、`height`、`fps`、コーデック関連のデフォルトを返すことができます。レンダリング開始前に一度実行されます。
|