Skip to content

motion-sv@0.1.11

Choose a tag to compare

@hanielu hanielu released this 04 Apr 23:32
· 6 commits to main since this release

Patch Changes

New Features

  • useCurrentMotionValue - Creates a reactive wrapper around a MotionValue with a current getter, similar to Svelte's native Tween and Spring classes. This allows using MotionValue in reactive contexts where .get() wouldn't trigger reactivity. (#3)

    <script>
      import { useMotionValue, useCurrentMotionValue } from 'motion-sv';
      const x = useMotionValue(0);
      const reactiveX = useCurrentMotionValue(x);
    </script>
    
    <p>Current x: {reactiveX.current}</p>
  • useFollowValue - New hook for following values with customizable animation options.

  • useClipPathWorkaround - Opt-in workaround for Chrome's IntersectionObserver behavior with clipPath and whileInView. Chrome correctly computes intersection based on visible/painted area, which means fully-clipped elements won't trigger whileInView. Enable via inViewOptions. (#9)

    <motion.div
      initial={{ clipPath: "inset(0% 100% 0% 0%)" }}
      whileInView={{ clipPath: "inset(0% 0% 0% 0%)" }}
      inViewOptions={{ useClipPathWorkaround: true }}
    />
  • Reactive inputRange in useTransform - Use reactiveInputRange() for dynamic breakpoints that update the transform when changed.

  • Multi-output useTransform - Transform a single input into multiple outputs:

    const { opacity, scale } = useTransform(x, [0, 100], {
      opacity: [0, 1],
      scale: [0.5, 1],
    });
  • Native scroll timeline support - useScroll now supports acceleration config for native scroll timeline animations when the browser supports it.

  • Export MotionStyle type - Now exported from the main entry point.

Improvements

  • useAnimate scoping fix - Refactored with proper proxy-based scope to ensure animations are correctly scoped to the component. (#7)

  • useSpring refactor - Now uses attachFollow from motion-dom for improved performance and consistency.

  • useInView API change - Renamed .isInView to .current for consistency with Svelte conventions.

Dependencies

  • framer-motion: ^12.23.12 → ^12.38.0
  • motion-dom: ^12.23.12 → ^12.38.0
  • motion-utils: ^12.23.6 → ^12.36.0

Breaking Changes

  • useInView().isInView is now useInView().current