creativescala / doodle

Compositional vector graphics in Scala / Scala.JS
https://creativescala.org/doodle/
Apache License 2.0
327 stars 75 forks source link

Configurable delay between frames in animated GIF #151

Open Jaca313 opened 5 months ago

Jaca313 commented 5 months ago

I'm still learning and i hope it is a simple issue. I would like to output my animation to a .gif file, but the delay seems to be coded to '20' in Java2dAnimationWriter and the gif is too fast.

Is it possible to change the delay in gif write while using approximately this syntax? animation.take(10).write[Gif]("example.gif", frame)

If i would like to change it am I supposed to use setDelay with addFrame(BufferedImage) and GifEncoder directly instead?

Thanks for help

noelwelsh commented 5 months ago

Supporting a different delay does seem like a useful feature. I'll have to think about how that can be best exposed in the API.

The existing code was copied from, I think, Processing and I have always found it a bit unreliable but have not had time to look into it in detaill.

noelwelsh commented 5 months ago

I think the path forward to create a new Frame type that allows specifying parameters for the GIF encoding.