MCPcopy
hub / github.com/motion-canvas/motion-canvas

github.com/motion-canvas/motion-canvas @v3.17.2 sqlite

repository ↗ · DeepWiki ↗ · release v3.17.2 ↗
2,381 symbols 6,805 edges 767 files 274 documented · 12%
README

  <img width="180" alt="Motion Canvas logo" src="https://motion-canvas.github.io/img/logo.svg">

published with lerna powered by vite npm package version discord

Motion Canvas

Motion Canvas is two things:

  • A TypeScript library that uses generators to program animations.
  • An editor providing a real-time preview of said animations.

It's a specialized tool designed to create informative vector animations and synchronize them with voice-overs.

Aside from providing the preview, the editor allows you to edit certain aspects of the animation which could otherwise be tedious.

Using Motion Canvas

Check out our getting started guide to learn how to use Motion Canvas.

Developing Motion Canvas locally

The project is maintained as one monorepo containing the following packages:

Name Description
2d The default renderer for 2D motion graphics
core All logic related to running and rendering animations.
create A package for bootstrapping new projects.
docs Our documentation website.
e2e End-to-end tests.
examples Animation examples used in documentation.
internal Internal helpers used for building the packages.
player A custom element for displaying animations in a browser.
template A template project included for developer's convenience.
ui The user interface used for editing.
vite-plugin A plugin for Vite used for developing and bundling animations.

After cloning the repo, run npm install in the root of the project to install all necessary dependencies. Then run npx lerna run build to build all the packages.

Developing Editor

When developing the editor, run the following command:

npm run template:dev

It will start a vite server that watches the core, 2d, ui, and vite-plugin packages. The template package itself contains a simple Motion Canvas project that can be used during development.

Developing Player

To develop the player, first build the template: npm run template:build. Then, start npm run player:dev.

Installing a local version of Motion Canvas in a project

It can be useful to install a local version of Motion Canvas in a standalone project. For example, when you want to use your own fork with some custom-made features to create your animations.

Let's assume the following project structure:

projects/
├── motion-canvas/ <- your local monorepo
└── my-project/ <- a bootstrapped project
    └── package.json

You can link the local packages from the monorepo by updating the package.json of your project. Simply replace the version with a file: followed by a relative path to the package you want to link:

  "dependencies": {
-   "@motion-canvas/core": "^3.11.0",
+   "@motion-canvas/core": "file:../motion-canvas/packages/core",
    // ...
  },

If you're linking the ui package, you'll also need to modify vite.config.ts to allow vite to load external files:

import {defineConfig} from 'vite';
import motionCanvas from '@motion-canvas/vite-plugin';

export default defineConfig({
  server: {
    fs: {
      // let it load external files
      strict: false,
    },
  },
  plugins: [motionCanvas()],
});

This is necessary because the editor styles are loaded using the /@fs/ prefix and since the linked ui package is outside the project, vite needs permission to access it.

Then run npm install in to apply the changes and that's it.

You can use the same technique to test out any custom package you're working on.

Contributing

Read through our Contribution Guide to learn how you can help make Motion Canvas better.

Extension points exported contracts — how you extend this code

Type (Interface)
(no doc) [8 implementers]
packages/core/src/types/Type.ts
Panel (Interface)
(no doc) [8 implementers]
packages/ui/src/contexts/panels.tsx
SourceNode (Interface)
(no doc) [5 implementers]
packages/vite-plugin/src/partials/webgl.ts
Type (Interface)
(no doc) [4 implementers]
packages/docs/src/contexts/api.tsx
CodeSignalHelpers (Interface)
(no doc) [3 implementers]
packages/2d/src/lib/code/CodeSignal.ts
MotionCanvasPlayerProps (Interface)
(no doc)
packages/player/types/main.d.ts
FFmpegExporterSettings (Interface)
(no doc)
packages/ffmpeg/server/FFmpegExporterServer.ts
SwitchProps (Interface)
(no doc)
packages/examples/src/components/Switch.tsx

Core symbols most depended-on inside this repo

signal
called by 149
packages/2d/src/lib/decorators/signal.ts
map
called by 145
packages/core/src/types/Vector.ts
add
called by 143
packages/vite-plugin/src/partials/webgl.ts
initial
called by 95
packages/2d/src/lib/decorators/signal.ts
scale
called by 88
packages/core/src/types/Vector.ts
computed
called by 82
packages/2d/src/lib/decorators/computed.ts
createSignal
called by 74
packages/core/src/signals/createSignal.ts
createRef
called by 73
packages/core/src/utils/createRef.ts

Shape

Method 1,024
Function 866
Interface 261
Class 213
Enum 17

Languages

TypeScript100%

Modules by API surface

packages/2d/src/lib/components/Node.ts89 symbols
packages/core/src/types/Vector.ts51 symbols
packages/2d/src/lib/components/Layout.ts49 symbols
packages/core/src/app/Player.ts36 symbols
packages/core/src/types/BBox.ts34 symbols
packages/core/src/tweening/timingFunctions.ts34 symbols
packages/2d/src/lib/components/SVG.ts34 symbols
packages/core/src/types/Matrix2D.ts33 symbols
packages/core/src/scenes/Scene.ts32 symbols
packages/core/src/scenes/GeneratorScene.ts29 symbols
packages/2d/src/lib/components/CodeBlock.ts28 symbols
packages/core/src/signals/SignalContext.ts24 symbols

Dependencies from manifests, versioned

@babel/standalone7.21.3 · 1×
@codemirror/lang-javascript6.1.4 · 1×
@commitlint/cli18.4.2 · 1×
@commitlint/config-conventional18.4.2 · 1×
@docusaurus/core2.4.0 · 1×
@docusaurus/module-type-aliases2.4.0 · 1×
@docusaurus/preset-classic2.4.0 · 1×
@docusaurus/theme-mermaid2.4.0 · 1×
@docusaurus/theme-search-algolia2.4.0 · 1×
@ffmpeg-installer/ffmpeg1.1.0 · 1×
@ffprobe-installer/ffprobe2.0.0 · 1×

For agents

$ claude mcp add motion-canvas \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact