import { Canvas, Vertices, vec } from "@shopify/react-native-skia";
const IndicesDemo = () => {
const vertices = [
vec(0, 0), // 0: top-left
vec(256, 0), // 1: top-right
vec(256, 256), // 2: bottom-right
vec(0, 256) // 3: bottom-left
];
const colors = ["#61DAFB", "#fb61da", "#dafb61", "#61fbcf"];
// First triangle: 0, 1, 2 (top-left, top-right, bottom-right)
const triangle1 = [0, 1, 2];
// Second triangle: 0, 2, 3 (top-left, bottom-right, bottom-left)
const triangle2 = [0, 2, 3];
const indices = [...triangle1, ...triangle2];
return (
<Canvas style={{ flex: 1 }}>
<Vertices
vertices={vertices}
colors={colors}
indices={indices}
/>
</Canvas>
);
};