import type Animated from "react-native-reanimated" ; import { useSharedValue } from "react-native-reanimated" ; summary example export interface Vector < T = number > { x : T ; y : T ; } summary export const useVector = ( x1 = 0 , y1 ? ) : Vector < Animated . SharedValue < number > > => { const x = useSharedValue ( x1 ) ; const y = useSharedValue ( y1 ?? x1 ) ; return { x , y } ; } ; type Create = { ( ) : Vector < 0 > ; < T extends Animated . Adaptable < number > > ( x , y ? ) : Vector < T > ; } ; param x param y worklet export const vec2 = < T extends Animated . Adaptable < number > > ( x ? , y ? ) => { "worklet" ; return { x : x ?? 0 , y : y ?? x ?? 0 , } ; } ; export const vec = { create : vec2 , } ;