Skip to content

Commit e5962bd

Browse files
committed
Add doc and example for GIF component
1 parent 15dec3d commit e5962bd

File tree

1 file changed

+23
-0
lines changed
  • packages/2d/src/Components

1 file changed

+23
-0
lines changed

packages/2d/src/Components/GIF.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ interface GIFInterface extends AnimationAPI<HTMLImageElement> {
77
drawCurrentFrame(context: CanvasRenderingContext2D, x?: number, y?: number): void;
88
}
99

10+
/**
11+
* A component which able you to play and manipulate gifs into hex-engine.
12+
* @example
13+
* import someGifFile from "./your.gif";
14+
*
15+
* export default function MyGif() {
16+
* useType(MyGif);
17+
*
18+
* const gif = useNewComponent(() => GIF({
19+
* url: someGifFile,
20+
* width: 200,
21+
* height: 200,
22+
* fps: 20,
23+
* loop: true
24+
* }));
25+
*
26+
* gif.play()
27+
*
28+
* useDraw((context) => {
29+
* gif.drawCurrentFrame(context);
30+
* });
31+
* }
32+
*/
1033
export default function GIF(options: {
1134
url: string,
1235
width: number,

0 commit comments

Comments
 (0)