-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCanvas.re
22 lines (20 loc) · 877 Bytes
/
Canvas.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open Document;
type canvas;
type context2d;
type reactRef;
[@mel.send] external getContext: (htmlElement, string) => context2d = "getContext";
[@mel.get] external getWidth: htmlElement => int = "width";
[@mel.get] external getHeight: htmlElement => int = "height";
[@mel.get] external getCurrent: reactRef => htmlElement = "current";
[@mel.send]
external clearRect: (context2d, float, float, float, float) => unit =
"clearRect";
[@mel.send] external beginPath: context2d => unit = "beginPath";
[@mel.send]
external arc: (context2d, float, float, float, float, float, bool) => unit =
"arc";
[@mel.set] external setFillStyle: (context2d, string) => unit = "fillStyle";
[@mel.send] external fill: context2d => unit = "fill";
[@mel.send] external closePath: context2d => unit = "closePath";
external requestAnimationFrame: (unit => unit) => unit =
"requestAnimationFrame";