Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
React Native Animated Rotation Anchor Point

I'm trying to get this rotation animation with an anchor point done, similar to the standard CSS attribute transform-origin. I've read about shifting the whole thing before the rotation like in this post, but i can't get that to work in my case.

My element is defined like this:

<Animated.View
    style={[ 
       styles.test,
       { transform: [{ rotate: rotateInterpolator }] },
    ]}
>
    <Text style={{ color: "white" }}>Test</Text>
</Animated.View>

with the following styles applied directly, since they are needed on mount:

test: {
    position: "absolute",
    top: 0,
    height: containerHeight,
    width: containerWidth,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "green",
    transform: [{ translateX: -containerHeight / 2 }, { translateY: -containerHeight / 2 }],
},

I have defined my interpolator for the rotation like this:

const rotateInterpolator = rotateValue.interpolate({
    inputRange: [0, 1],
    outputRange: ["90deg", "0deg"],
});

On user input, i start the animation for the Animated Value rotateValue:

Animated.timing(rotateValue, {
    toValue: 1,
    duration: 500,
    easing: Easing.linear,
    useNativeDriver: false,
}).start();

But since there is no option to define the anchor point, the element will rotate around its center, which is the center of the container defined by containerWidth and containerHeight.

However I want the anchor to be at the center on the bottom of the container, which would be (containerWidth / 2, containerHeight).

Any help is appreciated :)

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda