rslabdocs

Motion Fossil

A finger trace gains depth, mass and a permanent metallic form on release.

WebGPUThree.jsGesture HandlerSource

Prerequisites

This animation is built on the following libraries. expo install pins the versions that match your SDK, and the CLI tells you exactly which ones are missing when you add the component.


npx expo install three @react-three/fiber react-native-webgpu react-native-gesture-handler expo-blur expo-glass-effect expo-haptics react-native-safe-area-context @hugeicons/react-native @hugeicons/core-free-icons

Add @types/three as a dev dependency, and the react-native-webgpu plugin to your app.json:

{
  "expo": {
    "plugins": ["react-native-webgpu"]
  }
}

WebGPU also needs Metro to resolve three to its WebGPU build, and @react-three/fiber to its module entry on native:

metro.config.js
config.resolver.resolveRequest = (context, moduleName, platform) => {
  if (moduleName.startsWith('three')) {
    moduleName = 'three/webgpu';
  }

  if (platform !== 'web' && moduleName.startsWith('@react-three/fiber')) {
    return context.resolveRequest(
      {
        ...context,

        unstable_conditionNames: ['module'],

        mainFields: ['module'],
      },

      moduleName,

      platform,
    );
  }

  return context.resolveRequest(context, moduleName, platform);
};

Install


npx @rslab/cli add motion-fossil

Needs a custom development build, it does not run in Expo Go.

Usage

import { MotionFossil } from '@/components/ui/MotionFossil';

<MotionFossil accent="#D8663C" />;

See exactly how this works with an RSLAB subscription.

Get Pro

On this page