Skip to content

Commit

Permalink
misc changes lol
Browse files Browse the repository at this point in the history
  • Loading branch information
SheepTester committed Jun 20, 2024
1 parent c5bb45d commit 5e01d6f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
18 changes: 16 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { render } from './render/render'
import {
Annotation as AnnotationType,
Part,
exportScript,
strategize
} from './video-strategy'

Expand Down Expand Up @@ -291,8 +292,21 @@ export function App () {
<div className='output'>
<div className='menubar'>
<strong className='logo'>Ready Room</strong>
<button className='menubar-btn'>File</button>
<button className='menubar-btn'>Edit</button>
<button className='menubar-btn' disabled>
File
</button>
<button className='menubar-btn' disabled>
Edit
</button>
<button
className='menubar-btn'
onClick={() => {
console.log(exportScript(parts))
alert('check console for script')
}}
>
Export
</button>
</div>
<div className='preview'>
<canvas
Expand Down
41 changes: 39 additions & 2 deletions src/components/AnnotationContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,45 @@ export function AnnotationContents ({
case 'gesture':
return (
<span>
<strong>{gestureNames[annotation.gesture]}</strong> towards{' '}
<strong>{gestureTargetNames[annotation.towards]}</strong>
<select
value={annotation.gesture}
onChange={e => {
if (
e.currentTarget.value === 'point' ||
e.currentTarget.value === 'nod' ||
e.currentTarget.value === 'glance'
) {
onEdit?.({ ...annotation, gesture: e.currentTarget.value })
}
}}
disabled={!onEdit}
>
{Object.entries(gestureNames).map(([value, name]) => (
<option key={value} value={value}>
{name}
</option>
))}
</select>{' '}
towards{' '}
<select
value={annotation.towards}
onChange={e => {
if (
e.currentTarget.value === 'top' ||
e.currentTarget.value === 'middle' ||
e.currentTarget.value === 'bottom'
) {
onEdit?.({ ...annotation, towards: e.currentTarget.value })
}
}}
disabled={!onEdit}
>
{Object.entries(gestureTargetNames).map(([value, name]) => (
<option key={value} value={value}>
{name}
</option>
))}
</select>
</span>
)
case 'set-slide':
Expand Down
3 changes: 3 additions & 0 deletions src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ select:not(:disabled) {
height: 40px;
gap: 15px;
}
.menubar-btn:disabled {
opacity: 0.5;
}
.preview {
aspect-ratio: 16 / 9;
border-radius: 10px;
Expand Down
20 changes: 20 additions & 0 deletions src/video-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,23 @@ function * splitBySpaces (string: string): Generator<string> {
}
yield string.slice(lastIndex)
}

export function exportScript (parts: PartBase[]): string {
// https://docs.heygen.com/reference/create-an-avatar-video-v2#voice-settings
// look into this
return parts
.map(part =>
part.type === 'text'
? part.content
: part.annotation.type === 'set-layout'
? `[type: ${
part.annotation.layout === 'avatar-only'
? 'avatar-only'
: part.annotation.layout === 'slide-avatar'
? 'side-by-side'
: 'media-only'
}]`
: 'TODO'
)
.join('')
}

0 comments on commit 5e01d6f

Please sign in to comment.