Skip to content

Animated GIF component #43

@suchipi

Description

@suchipi

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 });
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    2dRelated to @hex-engine/2dgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions