-
Notifications
You must be signed in to change notification settings - Fork 419
/
Stickers.tsx
49 lines (45 loc) · 1.56 KB
/
Stickers.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Canvas, Matrix4, useFont, useImage } from "@shopify/react-native-skia";
import React from "react";
import { Dimensions, View } from "react-native";
import { useSharedValue } from "react-native-reanimated";
import { HelloSticker, HelloStickerDimensions } from "./HelloSticker";
import { LocationSticker, LocationStickerDimensions } from "./LocationSticker";
import { GestureHandler } from "./GestureHandler";
import { Picture, PictureDimensions } from "./Picture";
const { width, height } = Dimensions.get("window");
const zurich = require("./assets/zurich.jpg");
const aveny = require("./assets/aveny.ttf");
export const Stickers = () => {
const pictureMatrix = useSharedValue(Matrix4());
const helloMatrix = useSharedValue(Matrix4());
const locationMatrix = useSharedValue(Matrix4());
const image = useImage(zurich);
const font = useFont(aveny, 56);
if (!image || !font) {
return null;
}
return (
<View>
<Canvas style={{ width, height }}>
<Picture matrix={pictureMatrix} image={image} />
<HelloSticker matrix={helloMatrix} />
<LocationSticker font={font} matrix={locationMatrix} />
</Canvas>
<GestureHandler
matrix={pictureMatrix}
dimensions={PictureDimensions}
label="Picture of Zürich"
/>
<GestureHandler
matrix={helloMatrix}
dimensions={HelloStickerDimensions}
label="Hello Sticker"
/>
<GestureHandler
matrix={locationMatrix}
dimensions={LocationStickerDimensions}
label="Location Sticker"
/>
</View>
);
};