hex-engine
hex-engine copied to clipboard
Animated GIF component
It would be nice to have a component that can expose the frames of an animated GIF image using the Animation interface; I'm picturing something like this:
import { useType, useNewComponent, GIF, useDraw } from "@hex-engine/2d";
import someGifFile from "./whatever.gif";
function MyComponent() {
useType(MyComponent);
const gif = useNewComponent(() => GIF(someGifFile));
gif.play(); // `gif` has the same interface as AnimationAPI
useDraw((context) => {
gif.drawCurrentFrame(context, { x: 0, y: 0 });
});
}