1import Expo2DContext from 'expo-2d-context';
2
3import GLWrap from './GLWrap';
4
5export default GLWrap('Canvas example - expo-2d-context', async gl => {
6  const ctx = new Expo2DContext(gl);
7  ctx.translate(50, 200);
8  ctx.scale(4, 4);
9  ctx.fillStyle = 'grey';
10  ctx.fillRect(20, 40, 100, 100);
11  ctx.fillStyle = 'white';
12  ctx.fillRect(30, 100, 20, 30);
13  ctx.fillRect(60, 100, 20, 30);
14  ctx.fillRect(90, 100, 20, 30);
15  ctx.beginPath();
16  ctx.arc(50, 70, 18, 0, 2 * Math.PI);
17  ctx.arc(90, 70, 18, 0, 2 * Math.PI);
18  ctx.fill();
19  ctx.fillStyle = 'grey';
20  ctx.beginPath();
21  ctx.arc(50, 70, 8, 0, 2 * Math.PI);
22  ctx.arc(90, 70, 8, 0, 2 * Math.PI);
23  ctx.fill();
24  ctx.strokeStyle = 'black';
25  ctx.beginPath();
26  ctx.moveTo(70, 40);
27  ctx.lineTo(70, 30);
28  ctx.arc(70, 20, 10, 0.5 * Math.PI, 2.5 * Math.PI);
29  ctx.stroke();
30  ctx.flush();
31});
32