import type { TransformsStyle } from "react-native" ; import type Animated from "react-native-reanimated" ; import { useAnimatedStyle } from "react-native-reanimated" ; import type { Vector } from "./Vectors" ; import type { Transforms2d } from "./Matrix3" ; type RNTransform = Exclude < TransformsStyle [ "transform" ] , undefined > ; export const transformOrigin = ( { x , y } , transformations ) : RNTransform => { "worklet" ; return [ { translateX : x } , { translateY : y } , ... transformations , { translateX : - x } , { translateY : - y } , ] ; } ; export const transformOrigin2d = ( { x , y } , transformations ) : Transforms2d => { "worklet" ; return [ { translateX : x } , { translateY : y } , ... transformations , { translateX : - x } , { translateY : - y } , ] ; } ; export const useTranslation = ( { x , y , } ) => useAnimatedStyle ( ( ) => ( { transform : [ { translateX : x . value } , { translateY : y . value } ] , } ) ) ;