Skip to content

Commit

Permalink
Fix: smooth 30 fps output
Browse files Browse the repository at this point in the history
  • Loading branch information
naourass committed Nov 3, 2024
1 parent 2f97782 commit cbd2617
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions playgrounds/app/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '.
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './ui/accordion'

const animationSeconds = 1
const animationFPS = 10
const animationFPS = 30
const animationFrames = animationSeconds * animationFPS

const supportedFontFamilies: { name: string }[] = [
Expand Down Expand Up @@ -208,7 +208,7 @@ export default function Editor(props: EditorProps) {
middleFrames.push(i)
}

const pauseFrameLength = 15
const pauseFrameLength = 60
const firstFrames = new Array(pauseFrameLength).fill(0)
const lastFrames = new Array(pauseFrameLength).fill(animationFrames)

Expand Down Expand Up @@ -260,7 +260,7 @@ export default function Editor(props: EditorProps) {
format: 'blob',
width: canvasFrames[0].width,
height: canvasFrames[0].height,
frames: canvasFrames,
frames: canvasFrames.map(el => ({ data: el.data.buffer, delay: (animationSeconds * 1000) / animationFPS}))
})

const dataUrl = await blobToDataURL(blob)
Expand Down

0 comments on commit cbd2617

Please sign in to comment.