INNER CODE UNIT · TypeScript

shake

enzomanuelmangano/animate-with-reanimated · src/animations/20-shake-animation/hooks/use-animated-shake.ts:16

  const shake = useCallback(() => {
    const TranslationAmount = 10;
    const timingConfig = {
      // cubic-bezier(.35,.7,.5,.7)
      easing: Easing.bezier(0.35, 0.7, 0.5, 0.7),
      duration: 80,
    };
    shakeTranslateX.value = withSequence(
      withTiming(TranslationAmount, timingConfig),
      withRepeat(withTiming(-TranslationAmount, timingConfig), 3, true),
      withSpring(0, {
        mass: 0.5,
      })
    );
  }, []);

  const rStyle = useAnimatedStyle(() => {
    return {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…