npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@thewoowon/motionx

v0.1.0

Published

Unified motion engine for React & React Native - one component for Lottie, GIF, MP4, WebM

Readme

motionx

Unified Motion Engine for React & React Native

One component for all animation formats: Lottie, GIF, MP4, WebM

npm version License: MIT

🎯 Why motionx?

Stop juggling multiple animation libraries. motionx provides a single <Motion> component that works across all formats and platforms.

| Before (Multiple Libraries) | After (motionx) | |---------------------------|-----------------| | lottie-react-native | ✅ One Component | | lottie-web | ✅ One API | | react-native-video | ✅ React + RN | | Custom GIF handlers | ✅ Auto-detect format |


🚀 Installation

npm install @thewoowon/motionx
# or
yarn add @thewoowon/motionx

📦 Quick Start

import { Motion } from '@thewoowon/motionx';

function App() {
  return (
    <Motion
      source={require('./animation.json')}
      autoPlay
      loop
      width={200}
      height={200}
      onFinish={() => console.log('Done!')}
      fallback={<div>Loading...</div>}
    />
  );
}

That's it! motionx automatically detects the format and renders it correctly.


✨ Features

  • 🎨 Unified API - One component for all formats
  • 🔄 Auto-detection - Automatically detects Lottie, GIF, MP4, WebM
  • 📱 Cross-platform - Works on React Web & React Native
  • Zero config - Just pass the source
  • 🎭 Fallback support - Show loading states easily
  • 🎬 Full control - loop, autoPlay, speed, callbacks
  • 📦 Tiny - Minimal dependencies

🎬 Supported Formats

| Format | Web | React Native | Notes | |--------|-----|--------------|-------| | Lottie (JSON) | ✅ | ✅ | Full support | | GIF | ✅ | ✅ | Native rendering | | MP4 | ✅ | ⚠️ | RN needs react-native-video | | WebM | ✅ | ❌ | Web only |


📖 API Reference

Props

interface MotionProps {
  // Source (required)
  source: string | object | number;

  // Playback
  loop?: boolean;           // Default: false
  autoPlay?: boolean;       // Default: true
  speed?: number;           // Default: 1.0

  // Size
  width?: number;
  height?: number;

  // UI
  fallback?: ReactNode;     // Loading/error state
  style?: CSSProperties | ViewStyle;
  className?: string;       // Web only

  // Callbacks
  onPlay?: () => void;
  onPause?: () => void;
  onFinish?: () => void;
  onError?: (error: Error) => void;

  // Testing
  testID?: string;
}

🔥 Examples

Lottie Animation

<Motion
  source={require('./logo.json')}
  autoPlay
  loop
  width={300}
  height={300}
/>

From URL

<Motion
  source="https://assets.lottiefiles.com/packages/lf20_example.json"
  autoPlay
  fallback={<Spinner />}
/>

GIF

<Motion
  source={require('./loading.gif')}
  width={100}
  height={100}
/>

Video (MP4)

<Motion
  source="https://example.com/video.mp4"
  autoPlay
  loop
  width={640}
  height={360}
  onError={(err) => console.error(err)}
/>

React Native

import { Motion } from '@thewoowon/motionx';
import { View } from 'react-native';

<View>
  <Motion
    source={require('./splash.json')}
    autoPlay
    loop
    width={200}
    height={200}
    style={{ marginTop: 20 }}
  />
</View>

🎯 How It Works

  1. Format Detection - Automatically detects format from file extension or content
  2. Platform Detection - Chooses Web or React Native renderer
  3. Optimized Rendering - Uses the best library for each format:
    • Lottie: lottie-web (Web) / lottie-react-native (RN)
    • GIF: <img> (Web) / <Image> (RN)
    • Video: <video> (Web) / react-native-video (RN)*

*Note: React Native video requires installing react-native-video separately


🛠️ Advanced Usage

Custom Styling

<Motion
  source={require('./hero.json')}
  autoPlay
  loop
  style={{
    borderRadius: 16,
    boxShadow: '0 4px 20px rgba(0,0,0,0.1)',
    background: '#f5f5f5',
  }}
/>

Controlled Playback

function ControlledAnimation() {
  const [playing, setPlaying] = useState(false);

  return (
    <>
      <Motion
        source={require('./click.json')}
        autoPlay={playing}
        loop={false}
        onFinish={() => setPlaying(false)}
      />
      <button onClick={() => setPlaying(true)}>
        Play
      </button>
    </>
  );
}

Error Handling

<Motion
  source={unknownSource}
  fallback={<div>Failed to load animation</div>}
  onError={(error) => {
    console.error('Animation error:', error);
    analytics.track('animation_error', { error });
  }}
/>

📱 React Native Setup

For React Native projects, ensure you have the peer dependencies:

npm install lottie-react-native
# For video support (optional)
npm install react-native-video

Then link native modules:

cd ios && pod install

🎭 TypeScript Support

Full TypeScript support included:

import { Motion, MotionProps, MotionFormat } from '@thewoowon/motionx';

const props: MotionProps = {
  source: './animation.json',
  autoPlay: true,
  loop: true,
};

🗺️ Roadmap

v0.1 (Current)

  • ✅ Lottie, GIF, MP4, WebM support
  • ✅ React & React Native
  • ✅ Auto format detection
  • ✅ Unified API

v0.2 (Coming Soon)

  • [ ] Rive support
  • [ ] SpriteSheet animations
  • [ ] Frame control (seek, progress)
  • [ ] Animation preloading

v0.3+

  • [ ] Skeleton animations
  • [ ] SVG animations
  • [ ] Canvas-based rendering
  • [ ] Performance optimizations

🤝 Contributing

Contributions welcome! Please read CONTRIBUTING.md first.


📄 License

MIT © eternalgridx


💡 Philosophy

"애니메이션은 파일 포맷이 아니라 'Motion' 개념이다."

motionx는 개발자가 구현에 집중하도록, 포맷의 복잡함을 숨깁니다.

디자이너가 파일만 던져주면, 개발자는 <Motion>만 쓰면 됩니다. 끝.