Skip to content

Commit

Permalink
Add doc and example for GIF component
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilienLeroy committed Jul 13, 2020
1 parent 4287271 commit 11caadf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/2d/src/Components/GIF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ interface GIFInterface extends AnimationAPI<HTMLImageElement> {
drawCurrentFrame(context: CanvasRenderingContext2D, x?: number, y?: number): void;
}

/**
* A component which able you to play and manipulate gifs into hex-engine.
* @example
* import someGifFile from "./your.gif";
*
* export default function MyGif() {
* useType(MyGif);
*
* const gif = useNewComponent(() => GIF({
* url: someGifFile,
* width: 200,
* height: 200,
* fps: 20,
* loop: true
* }));
*
* gif.play()
*
* useDraw((context) => {
* gif.drawCurrentFrame(context);
* });
* }
*/
export default function GIF(options: {
url: string,
width: number,
Expand Down

0 comments on commit 11caadf

Please sign in to comment.