Motion Canvas Documentation

website·Indexed 31 days ago

https://archive.canvascommons.io

Documentation for Motion Canvas, a tool for creating programmatic animations using generator functions. Covers core concepts including tweening, signals, scene hierarchy, and animation flow, as well as specialized features like LaTeX, shaders, and custom plugins. Includes guides for rendering via FFmpeg or image sequences, and migration details for v3.

Tokens
163.7K
Snippets
1.4K
Records
1.8K
Agent score
46%

What's inside Motion Canvas

  1. Overview of Matrix2D for 2D transformations

    The Matrix2D class implements TypeWebGLConvertible and represents a 2D transformation using a specialized 2x3 matrix. It contains six elements defined as [a, b, c, d, tx, ty], which serves as a shortcut for a 3x3 matrix of the form:

    [a, b, 0] [c, d, 0] [tx, ty, 1]

    Because it ignores z-values, it does not satisfy all standard 3x3 matrix properties: it has no transpose, and distributive/scalar properties (like A(B + C) = AB + AC) do not hold.

  2. Overview of Motion Canvas Meta runtime representation

    The @motion-canvas/core/lib/meta module provides the runtime representation of meta files. It includes a variety of specialized meta-field classes for different data types and utility types for managing object-based meta-fields.
    import { ... } from "@motion-canvas/core/lib/meta";
  3. Overview of Motion Canvas components and purpose

    Motion Canvas is an open-source tool designed for creating informative vector animations synchronized with voice-overs. It is not intended as a replacement for traditional video editing software. It consists of two primary components: a TypeScript library that utilizes generators to program animations, and an editor that provides a real-time preview and allows for the modification of specific animation aspects (such as time events).
  4. Use FlagDispatcher to manage state-based event notifications

    The FlagDispatcher class dispatches a SubscribableFlagEvent. It behaves differently than a standard event dispatcher: subscribers are notified only when the flag is first set. Subsequent calls to raise() do not trigger additional notifications. However, any handlers added via subscribe() while the flag is already raised are invoked immediately. Resetting the flag does not notify subscribers, but raising it again after a reset will trigger notifications once more.
  5. Use EventDispatcher to manage event subscriptions

    The EventDispatcher<T> class is used to dispatch SubscribableEvent objects. It allows multiple handlers to subscribe to an event and be notified when that event is dispatched with a value of type T.
    class EventDispatcher<T> extends EventDispatcherBase<T>
  6. Use the HighlightResult interface for code highlighting

    The HighlightResult interface describes the result of a highlight operation on a piece of code. It provides information about the color of the token at a specific index and how many characters to skip to reach the end of that token.
  7. Use SubscribableValueEvent to provide read-only event access

    The SubscribableValueEvent<T> class provides safe access to the public interface of a ValueDispatcher. It allows external classes to subscribe to an event and receive value updates without granting them the ability to dispatch the event themselves.
    // SubscribableValueEvent<T> extends Subscribable<T> and EventHandler<T>
  8. Use the DetailedError class for enhanced error logging

    The DetailedError class extends the standard JavaScript Error object. It is designed to provide richer context for logs, allowing developers to attach durations, inspection keys, and serialized objects to an error. It is further extended by the ExperimentalError class.
    class DetailedError extends Error
  9. LatexProps Interface Overview

    The LatexProps interface defines the configuration options for LaTeX components. It extends OmitSVGProps<'svg'>, meaning it inherits standard SVG properties while providing specific overrides and additions for 2D node behavior, layout, and rendering.
    interface LatexProps extends OmitSVGProps<'svg'>
  10. Use EventDispatcherBase to manage event subscriptions

    EventDispatcherBase is an abstract base class used for dispatching Subscribable events. It manages a collection of handlers that are invoked when an event occurs. It uses two type parameters: TValue for the type of the argument passed to subscribers, and THandler for the type of the callback function (which must extend EventHandler<TValue>).
    abstract class EventDispatcherBase<TValue, THandler extends EventHandler<TValue> = EventHandler<TValue>>