Skip to content

Feature/psd animation#4

Open
aqiq-marine wants to merge 19 commits intoframe-script:mainfrom
aqiq-marine:feature/psd-animation
Open

Feature/psd animation#4
aqiq-marine wants to merge 19 commits intoframe-script:mainfrom
aqiq-marine:feature/psd-animation

Conversation

@aqiq-marine
Copy link

ゆっくり動画を簡単に作成するため、psdファイルを制御するコンポーネントを作成しました。
( #2 )

使用例

export const PROJECT = () => {
  const eyeUtilDict = {
      kind: "bool" as const,
      options: {
          Default: "顔パーツ/目/開き",
          Open: "顔パーツ/目/開き",
          HalfOpen: "顔パーツ/目/やや開き",
          HalfClosed: "顔パーツ/目/やや閉じ",
          Closed: "顔パーツ/目/閉じ",
      }
  }
  const mouthUtilDict = {
      kind: "bool" as const,
      options: {
          Default: "顔パーツ/口/閉じ",
          a: "顔パーツ/口/あ",
          i: "顔パーツ/口/い",
          u: "顔パーツ/口/う",
          e: "顔パーツ/口/え",
          o: "顔パーツ/口/お",
          x: "顔パーツ/口/閉じ",
      }
  }
  const LipSync = createLipSync(mouthUtilDict)
  const Blink = createBlink(eyeUtilDict)
  return (
    <Project>
      <TimeLine>
        <Clip label="Hello">
          <PsdCharacter psd="../assets/フリー.psd">
            <MotionSequence>
              <Block>
                <Voice voice="../assets/001.wav" volume={0.5} />
                <LipSync data={lipsync1} />
              </Block>
              <Voice voice="../assets/002.wav" />
            </MotionSequence>
            <Blink data={blink1} />
            <DeclareVariable variableName="t" initValue={0}>
              <DeclareAnimation f={async (ctx, variables) => {
                await ctx.move(variables["t"]).to(1, seconds(1), BEZIER_SMOOTH)
              }}>
                <Motion motion={(variables, frames) => {
                  const t = variables["t"].get(frames[0])
                  if (t == 1) {
                      return {}
                  } else if (t < 0.5) {
                    return {
                      [eyeUtilDict.options.Open]: false,
                      [eyeUtilDict.options.Closed]: true,
                    }
                  } else {
                    return {
                      [eyeUtilDict.options.Open]: true,
                      [eyeUtilDict.options.Closed]: false,
                    }
                  }
                }} />
              </DeclareAnimation>
            </DeclareVariable>
          </PsdCharacter>
        </Clip>
      </TimeLine>
    </Project>
  )
}

@bea4dev
Copy link
Contributor

bea4dev commented Mar 9, 2026

ありがとうございます!
近日中できるだけ早くレビューしますのでしばらくお待ち下さい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants