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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@microfox/remotion

v1.2.6

Published

A recursive composition system for Remotion with unified component architecture

Downloads

55

Readme

@microfox/remotion

A recursive composition system built on top of Remotion's core components. It provides a unified architecture where every component (frames, layouts, atoms) follows the same recursive pattern, enabling infinite nesting and flexible video composition.

🎯 Core Philosophy: The Three Pillars

1. Recursive Component Pattern

Everything is a RenderableComponent that can contain other renderable components:

  • Frame → Contains multiple Layouts
  • Layout → Contains multiple Atoms OR SubLayouts
  • Atom → Smallest renderable unit (text, image, video, etc.)

2. Context-Driven Rendering

Each component automatically calculates its boundaries and context:

  • Spatial Boundaries: x, y, width, height, zIndex
  • Temporal Boundaries: startFrame, durationFrames, delay
  • Hierarchy Context: depth, parentIds, childIds
  • Remotion Context: currentFrame, fps, composition dimensions

3. Remotion-Native Design

Built entirely on Remotion's core components:

  • AbsoluteFill for positioning
  • Sequence for timing
  • Img, Video, Audio for media
  • Timeline synchronization and performance optimization

🚀 Installation

npm install @microfox/remotion

📖 Basic Usage

import { Composition, SceneFrame, GridLayout, TextAtom } from '@microfox/remotion';

const MyComposition = () => (
  <Composition
    components={[
      {
        id: 'scene-1',
        type: 'frame',
        data: {},
        context: {
          boundaries: { x: 0, y: 0, width: 1920, height: 1080, zIndex: 0 },
          timing: { startFrame: 0, durationFrames: 30, delay: 0 },
          hierarchy: { depth: 0, parentIds: [], childIds: [] },
          remotion: { currentFrame: 0, fps: 30, composition: { width: 1920, height: 1080, duration: 30 } }
        }
      }
    ]}
    width={1920}
    height={1080}
    duration={30}
    fps={30}
  />
);

🎬 Component Types

Frames (Scene Directors)

  • SceneFrame: Full composition frame
  • OverlayFrame: Overlay on existing content

Layouts (Assistant Directors)

  • GridLayout: Grid arrangement with configurable columns/rows
  • VerticalLayout: Vertical stacking with spacing
  • HorizontalLayout: Horizontal arrangement with spacing

Atoms (Actors)

  • TextAtom: Text rendering with styling
  • ImageAtom: Image rendering with positioning
  • VideoAtom: Video rendering with controls

🔄 Recursive Pattern Examples

Example 1: Nested Grid Layout

const nestedGridExample = {
  id: 'scene-1',
  type: 'frame',
  data: {},
  context: {
    /* ... */
  },
  children: [
    {
      id: 'grid-1',
      type: 'layout',
      data: { columns: 2, rows: 2, spacing: 20 },
      context: {
        /* ... */
      },
      children: [
        {
          id: 'text-1',
          type: 'atom',
          data: { text: 'Hello World', style: { fontSize: '48px' } },
          context: {
            /* ... */
          },
        },
        {
          id: 'image-1',
          type: 'atom',
          data: { src: 'https://example.com/image.jpg' },
          context: {
            /* ... */
          },
        },
      ],
    },
  ],
};

🔧 Advanced Features

Context Propagation

Components automatically inherit and calculate their context from parent components:

const contextExample = {
  boundaries: {
    x: 100, // Inherited from parent
    y: 50, // Inherited from parent
    width: 800, // Calculated based on parent
    height: 600, // Calculated based on parent
    zIndex: 1, // Incremented from parent
  },
  timing: {
    startFrame: 0, // Inherited from parent
    durationFrames: 30, // Inherited from parent
    delay: 5, // Added to parent timing
  },
  hierarchy: {
    depth: 2, // Incremented from parent
    parentIds: ['root', 'parent-1'], // Tracked automatically
    childIds: [], // Populated automatically
  },
};

Registry System

Register custom components for external package integration:

import { registerComponent } from '@microfox/remotion';

// Register custom components
registerComponent('custom-layout', CustomLayout, 'layout');
registerComponent('custom-atom', CustomAtom, 'atom');

Templates

The package includes pre-built templates for common use cases.

RingsComposition

A composition featuring the Next.js logo animation with concentric rings and a text fade effect.

Usage:

import React from 'react';
import { RingsComposition } from '@microfox/remotion';

const MyVideo = () => {
  return (
    <RingsComposition
      title="My Custom Title"
    />
  );
};

�� Key Benefits

  1. Unified Architecture - Single pattern for all components
  2. Infinite Nesting - Any component can contain any other component
  3. Context Awareness - Automatic boundary and timing calculation
  4. Remotion Native - Built on Remotion's core components
  5. Extensible - Easy external package integration
  6. Performance - Optimized rendering with Remotion's engine

📋 Development

Building

npm run build

Testing

npm test

Linting

npm run lint

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.


This package provides a powerful foundation for building complex video compositions with Remotion using a unified, recursive component architecture.