Skip to content

Instantly share code, notes, and snippets.

View marcelosanchez's full-sized avatar
💭
Learning

Marcelo Sánchez marcelosanchez

💭
Learning
View GitHub Profile
@marcelosanchez
marcelosanchez / usePivotTransform.ts
Last active May 12, 2025 14:42
React Native Reanimated: Hook to apply custom pivot rotation transform
import { useSharedValue, useAnimatedStyle, withTiming, useDerivedValue, Easing } from 'react-native-reanimated';
// Matrix functions
const createTranslationMatrix = (dx: number, dy: number): number[] => {
'worklet';
return [1, 0, 0, 0, 1, 0, dx, dy, 1];
};
const createRotationMatrix = (radians: number): number[] => {
'worklet';