Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0531566
chore: add new directory for PsdCharacter
aqiq-marine Mar 7, 2026
a226a1f
chore: add index.ts
aqiq-marine Mar 7, 2026
3a32d9b
feature: add ast
aqiq-marine Mar 7, 2026
d89cce5
feature: add psd character component
aqiq-marine Mar 7, 2026
97b4747
fix: export components
aqiq-marine Mar 7, 2026
ed7ec45
fix: fix DeclareVariable
aqiq-marine Mar 7, 2026
e5b9068
feature: add parser
aqiq-marine Mar 8, 2026
519773c
fix: fix fetch url
aqiq-marine Mar 8, 2026
7dabdd9
feature: add runtime
aqiq-marine Mar 8, 2026
186f19a
feature: add voice volume tune
aqiq-marine Mar 8, 2026
07926ce
feature: fix voice volume
aqiq-marine Mar 8, 2026
8653b8f
fix: fix register cache
aqiq-marine Mar 8, 2026
e4cd0fd
feature: add blink
aqiq-marine Mar 8, 2026
8dc4c22
fix: performance tune
aqiq-marine Mar 8, 2026
d658b9d
fix: animation error
aqiq-marine Mar 8, 2026
62f2452
fix: add package for psd
aqiq-marine Mar 8, 2026
88bf1e0
add: add comment
aqiq-marine Mar 8, 2026
0a0c5c3
chore: delete duplicated package
aqiq-marine Mar 8, 2026
2eb640b
fix: duplicated register
aqiq-marine Mar 10, 2026
fcbae2a
fix: add className
aqiq-marine Mar 12, 2026
a2358da
fix: add sound props
aqiq-marine Mar 13, 2026
2236022
init character manager branch
aqiq-marine Mar 14, 2026
f2143a5
feature: add ast
aqiq-marine Mar 14, 2026
3ee8456
feature: add character-manager-component
aqiq-marine Mar 14, 2026
139c413
feature: add dialogSenario
aqiq-marine Mar 14, 2026
94a14bc
fix: type validate
aqiq-marine Mar 14, 2026
43392a8
fix: add className
aqiq-marine Mar 14, 2026
cdec21e
feature: non-speaker component in chapter
aqiq-marine Mar 15, 2026
5642b44
fix: render first frame
aqiq-marine Mar 15, 2026
51aa617
fix: export manager component
aqiq-marine Mar 15, 2026
d7df7a3
fix: lint
aqiq-marine Mar 15, 2026
0286cf5
feature: add option for merge implicit characters
aqiq-marine Mar 15, 2026
77bf9ad
fix: type DeclareVariable
aqiq-marine Mar 20, 2026
bf11c88
feature: add declareVariables
aqiq-marine Mar 20, 2026
51c0f66
fix: type AnimationContext
aqiq-marine Mar 20, 2026
3bb8604
fix: delete debug log
aqiq-marine Mar 20, 2026
53038b5
fix: await animation
aqiq-marine Mar 21, 2026
a68930e
feature: type variables value
aqiq-marine Mar 21, 2026
edc5b0e
fix: rename animation definition
aqiq-marine Mar 21, 2026
48504cf
fix: add comments
aqiq-marine Mar 21, 2026
eb67150
change: rename Block to MotionClip
aqiq-marine Mar 21, 2026
3f6d05c
change: enable voice to take voiceMotion
aqiq-marine Mar 22, 2026
e875661
feature: add simple lipsync component
aqiq-marine Mar 22, 2026
b7425ec
refactor: applyOption
aqiq-marine Mar 22, 2026
f42b419
fix: simplelipsync
aqiq-marine Mar 22, 2026
c6a128c
change: enable DeclareCharacter to take no child
aqiq-marine Mar 22, 2026
5169bd3
fix: className
aqiq-marine Mar 25, 2026
9e0aacb
fix: check default
aqiq-marine Mar 28, 2026
02e9b2c
add: comments
aqiq-marine Mar 28, 2026
6c49be4
add: comments
aqiq-marine Mar 28, 2026
2e7cb4b
add: manager comments
aqiq-marine Mar 28, 2026
5f3673d
fix: create clip for voice
aqiq-marine Mar 29, 2026
605cd09
add: ja document
aqiq-marine Mar 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions docs/i18n/ja/docusaurus-plugin-content-docs/current/lib/media.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,174 @@ import { Character } from "../src/lib/sound/character"
clipLabel="Voice"
/>
```

### `<PsdCharacter>`

PSDファイルを利用した、口パクなどのアニメーションを制御します。
`<PsdCharacter>`コンポーネント内で、専用のコンポーネントを利用してPSDのオプションを制御し、canvasへ描画します。
コンポーネントを作成することもできますが、内部でフックを使うことは出来ません。

```tsx
import { BEZIER_SMOOTH } from "../src/lib/animation/functions"
import { seconds } from "../src/lib/frame"
import { PsdCharacter, MotionSequence, MotionWithVars, createSimpleLipSync } from "../src/lib/character/character-unit"


const SimpleLipSync = createSimpleLipSync({
kind: "bool",
options: {
Default: "表情/口/1",
Open: "表情/口/1",
Closed: "表情/口/5",
}
})

<PsdCharacter psd="../assets/char.psd" className="char">
<MotionSequence>
<SimpleLipSync voice="../assets/001_char.wav" />
<MotionWithVars
variables={{t: 0 as number}}
animation={async (ctx, variables) => {
await ctx.move(variables.t).to(1, seconds(1), BEZIER_SMOOTH)

}}
motion={(variables, frames) => {
const t = variables.time.get(frames[0])
if (t > 0.5) {
return {
"表情/目/9": false,
"表情/目/17": true
}
} else {
return {}
}
}}
/>

</MotionSequence>
</PsdCharacter>
```

主なコンポーネントは次の通りです。

#### `<MotionSequence>`

子要素を直列化します。
内部的には`<Sequence>`を利用しており、子要素は`<Clip>`で囲われます。

```tsx
import { MotionSequence, createSimpleLipSync } from "../src/lib/character/character-unit"

const SimpleLipSync = createSimpleLipSync({
kind: "bool",
options: {
Default: "表情/口/1",
Open: "表情/口/1",
Closed: "表情/口/5",
}
})

<MotionSequence>
<SimpleLipSync voice="../assets/001_char.wav" />
<SimpleLipSync voice="../assets/002_char.wav" />
</MotionSequence>
```

#### MotionClip

MotionSequence直下で使用して、子要素を並列化します。

```tsx
import { MotionSequence, MotionClip, createSimpleLipSync } from "../src/lib/character/character-unit"

const SimpleLipSync = createSimpleLipSync({
kind: "bool",
options: {
Default: "表情/口/1",
Open: "表情/口/1",
Closed: "表情/口/5",
}
})

<MotionSequence>
<SimpleLipSync voice="../assets/001_char.wav" />
<MotionClip>
<SimpleLipSync voice="../assets/002_char.wav" />
<SimpleLipSync voice="../assets/003_char.wav" />
</MotionClip>
</MotionSequence>
```

#### Voice

音声を配置します。
内部的には音声はClipで囲われます。

```tsx
import { Voice } from "../src/lib/character/character-unit"

<Voice voice="../assets/001_char.wav" />
```

#### MotionWithVars

変数を使用したアニメーションを作成します。
`variables`で変数を宣言し、次に`animation`でアニメーションを宣言し、最後に`motion`でPSDのオプションを返します。
オプションはag-psd-psdtoolの`renderPsd`の引数`data`に準拠します。

`PsdCharacter`以下ではフックが使えないため、`Variable`の値は`frames[0]`を利用して、`get`メソッドから得てください。

`frames[0]`には`useCurrentFrame`で得られるフレーム数が入っていますが、`MotionWithVars`自体は`<Clip>`で囲われないことに注意してください。

```tsx
import { BEZIER_SMOOTH } from "../src/lib/animation/functions"
import { seconds } from "../src/lib/frame"
import { MotionWithVars } from "../src/lib/character/character-unit"

<MotionWithVars
variables={{t: 0 as number}}
animation={async (ctx, variables) => {
await ctx.move(variables.t).to(1, seconds(1), BEZIER_SMOOTH)

}}
motion={(variables, frames) => {
const t = variables.time.get(frames[0])
if (t > 0.5) {
return {
"表情/目/9": false,
"表情/目/17": true
}
} else {
return {}
}
}}
/>
```

#### `createSimpleLipSync`

PSDファイルに対応した音量ベースの口パクを行うコンポーネントを返す関数です。
##### psd-tool-kitに対応している場合
`Mouth`にはPSDの口のレイヤーを指定します。
`Default`にはPSDファイルがデフォルトで表示する口のオプションを指定します。
`Open`, `Closed`にはそれぞれ対応するオプションを指定します。

##### psd-tool-kitに対応していない場合
`Default`にはPSDファイルがデフォルトで表示する口のレイヤーを指定します。
`Open`, `Closed`にはそれぞれ対応するレイヤーを指定します。

```tsx
import { createSimpleLipSync } from "../src/lib/character/character-unit"

const SimpleLipSync = createSimpleLipSync({
kind: "bool",
options: {
Default: "表情/口/1",
Open: "表情/口/1",
Closed: "表情/口/5",
}
})

<SimpleLipSync voice="../assets/001_char.wav" />
```

Loading