GithubHelp home page GithubHelp logo

Comments (2)

Latropos avatar Latropos commented on June 12, 2024 1

Hi @AlexIoanGheorghita!
In fact all the animations run, but only translateY resets the animated value to its initial value.
It means that in first loop you animate translateY from translateY_initial_val to 0, opacityGroup from opacityGroup_initial_val to 1 etc.
And in the second loop you animate translateY again from translateY_initial_val to 0 (since function withRepeat is expected to restart the animated value), but you animate opacityGroup from 1 to 1! This behaviour is expected.

I've created the following snippets of code to show you how to fix the problem

CODERecording
  const translateY = useSharedValue(100);
  const translateX = useSharedValue(100);

  useEffect(() => {
    translateY.value = withRepeat(
      withRepeat(
        withSpring(0, { damping: 12, stiffness: 85 }, () => {
          translateX.value = withTiming(translateX.value + 100, {
            duration: 500,
          });
        })
      )
    );
  }, [translateY, translateX]);
Screen.Recording.2024-03-11.at.12.21.54.mov
  const translateY = useSharedValue(100);
  const translateX = useSharedValue(100);

  useEffect(() => {
    translateY.value = withRepeat(
      withRepeat(
        withSpring(0, { damping: 12, stiffness: 85 }, () => {
          translateX.value = 100;
          translateX.value = withTiming(200, {
            duration: 500,
          });
        })
      )
    );
  }, [translateY, translateX]);
Screen.Recording.2024-03-11.at.12.23.47.mov

from react-native-reanimated.

github-actions avatar github-actions commented on June 12, 2024

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

from react-native-reanimated.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.