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)
180 lines
4.4 KiB
Markdown
180 lines
4.4 KiB
Markdown
---
|
|
name: timing
|
|
description: Remotionの補間カーブ - 線形、イージング、スプリングアニメーション
|
|
metadata:
|
|
tags: spring, bounce, easing, interpolation
|
|
---
|
|
|
|
シンプルな線形補間は `interpolate` 関数を使用して行います。
|
|
|
|
```ts title="100フレームかけて0から1へ"
|
|
import {interpolate} from 'remotion';
|
|
|
|
const opacity = interpolate(frame, [0, 100], [0, 1]);
|
|
```
|
|
|
|
デフォルトでは値はクランプされないため、[0, 1]の範囲外の値になることがあります。
|
|
クランプする方法は以下の通りです:
|
|
|
|
```ts title="外挿ありで100フレームかけて0から1へ"
|
|
const opacity = interpolate(frame, [0, 100], [0, 1], {
|
|
extrapolateRight: 'clamp',
|
|
extrapolateLeft: 'clamp',
|
|
});
|
|
```
|
|
|
|
## スプリングアニメーション
|
|
|
|
スプリングアニメーションはより自然な動きになります。
|
|
時間の経過とともに0から1へ変化します。
|
|
|
|
```ts title="100フレームかけて0から1へのスプリングアニメーション"
|
|
import {spring, useCurrentFrame, useVideoConfig} from 'remotion';
|
|
|
|
const frame = useCurrentFrame();
|
|
const {fps} = useVideoConfig();
|
|
|
|
const scale = spring({
|
|
frame,
|
|
fps,
|
|
});
|
|
```
|
|
|
|
### 物理プロパティ
|
|
|
|
デフォルト設定は `mass: 1, damping: 10, stiffness: 100` です。
|
|
これにより、アニメーションは落ち着く前に少しバウンスします。
|
|
|
|
設定は以下のように上書きできます:
|
|
|
|
```ts
|
|
const scale = spring({
|
|
frame,
|
|
fps,
|
|
config: {damping: 200},
|
|
});
|
|
```
|
|
|
|
バウンスなしの自然な動きに推奨される設定は `{ damping: 200 }` です。
|
|
|
|
よく使われる設定:
|
|
|
|
```tsx
|
|
const smooth = {damping: 200}; // スムーズ、バウンスなし(繊細な表示)
|
|
const snappy = {damping: 20, stiffness: 200}; // スナッピー、最小限のバウンス(UI要素)
|
|
const bouncy = {damping: 8}; // バウンシーな入場(遊び心のあるアニメーション)
|
|
const heavy = {damping: 15, stiffness: 80, mass: 2}; // 重い、ゆっくり、小さなバウンス
|
|
```
|
|
|
|
### 遅延
|
|
|
|
アニメーションはデフォルトで即座に開始されます。
|
|
`delay` パラメータを使って指定フレーム数だけアニメーションを遅らせます。
|
|
|
|
```tsx
|
|
const entrance = spring({
|
|
frame: frame - ENTRANCE_DELAY,
|
|
fps,
|
|
delay: 20,
|
|
});
|
|
```
|
|
|
|
### 長さ
|
|
|
|
`spring()` は物理プロパティに基づいた自然な長さを持ちます。
|
|
特定の長さにアニメーションを引き伸ばすには `durationInFrames` パラメータを使用します。
|
|
|
|
```tsx
|
|
const spring = spring({
|
|
frame,
|
|
fps,
|
|
durationInFrames: 40,
|
|
});
|
|
```
|
|
|
|
### spring()とinterpolate()の組み合わせ
|
|
|
|
スプリングの出力(0-1)をカスタム範囲にマッピングします:
|
|
|
|
```tsx
|
|
const springProgress = spring({
|
|
frame,
|
|
fps,
|
|
});
|
|
|
|
// 回転にマッピング
|
|
const rotation = interpolate(springProgress, [0, 1], [0, 360]);
|
|
|
|
<div style={{rotate: rotation + 'deg'}} />;
|
|
```
|
|
|
|
### スプリングの加算
|
|
|
|
スプリングは数値を返すだけなので、算術演算が可能です:
|
|
|
|
```tsx
|
|
const frame = useCurrentFrame();
|
|
const {fps, durationInFrames} = useVideoConfig();
|
|
|
|
const inAnimation = spring({
|
|
frame,
|
|
fps,
|
|
});
|
|
const outAnimation = spring({
|
|
frame,
|
|
fps,
|
|
durationInFrames: 1 * fps,
|
|
delay: durationInFrames - 1 * fps,
|
|
});
|
|
|
|
const scale = inAnimation - outAnimation;
|
|
```
|
|
|
|
## イージング
|
|
|
|
`interpolate` 関数にイージングを追加できます:
|
|
|
|
```ts
|
|
import {interpolate, Easing} from 'remotion';
|
|
|
|
const value1 = interpolate(frame, [0, 100], [0, 1], {
|
|
easing: Easing.inOut(Easing.quad),
|
|
extrapolateLeft: 'clamp',
|
|
extrapolateRight: 'clamp',
|
|
});
|
|
```
|
|
|
|
デフォルトのイージングは `Easing.linear` です。
|
|
その他の凸性:
|
|
|
|
- `Easing.in` - ゆっくり開始して加速
|
|
- `Easing.out` - 速く開始して減速
|
|
- `Easing.inOut`
|
|
|
|
カーブ(最も線形から最も曲線的な順):
|
|
|
|
- `Easing.quad`
|
|
- `Easing.sin`
|
|
- `Easing.exp`
|
|
- `Easing.circle`
|
|
|
|
イージング関数を作るには凸性とカーブを組み合わせる必要があります:
|
|
|
|
```ts
|
|
const value1 = interpolate(frame, [0, 100], [0, 1], {
|
|
easing: Easing.inOut(Easing.quad),
|
|
extrapolateLeft: 'clamp',
|
|
extrapolateRight: 'clamp',
|
|
});
|
|
```
|
|
|
|
3次ベジェ曲線もサポートされています:
|
|
|
|
```ts
|
|
const value1 = interpolate(frame, [0, 100], [0, 1], {
|
|
easing: Easing.bezier(0.8, 0.22, 0.96, 0.65),
|
|
extrapolateLeft: 'clamp',
|
|
extrapolateRight: 'clamp',
|
|
});
|
|
```
|