GithubHelp home page GithubHelp logo

exporters's Introduction


Motion Canvas logo

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.

exporters's People

Contributors

aarthificial avatar motion-canvas-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

exporters's Issues

Lottie exporter

Description
Lottie is a mature and feature-rich format for describing vector animations.
The ecosystem contains players for various different platforms.
Allowing Motion Canvas to export (and in the future import) this format will greatly increase compatibility with other software and allow people to host their animations without compromising the quality.

Proposed solution
Add a Lottie exporter

Positive audio offset doesn't work

Describe the bug
An audio that's been offset using a positive value (starts after the video) does not get delayed in the exported video.

To Reproduce

  1. Create a project with an audio file.
  2. In the Video Settings tab, set the audio offset to a positive value.
  3. Export the video with the "include audio" option selected.

Expected behavior
The audio should be delayed in the exported video to match the editor preview.

Package versions:

  • ffmpeg: 1.1.0

Additional context
Exporting works correctly for negative values.

// FIXME Offset only works for negative values.
.inputOptions([`-itsoffset ${settings.audioOffset ?? 0}`]);

Incorrect length reading on project.mp4 linux

Describe the bug
When I export a video on my linux mint desktop using the ffmpeg exporter, vlc (and my other installed media players) recognize it as having a much longer length than the video actually is, and it stops at the correct time but before the playback head has reached the end of the line.

To Reproduce
export a video using the ffmpeg exporter, maybe operating system has something to do with it? I also have audio on the video which has a negative start value and exceeds the end of the graphics, but the video doesn't keep rendering with the remainder of the audio and the length doesn't match so i'm unsure if that is relevant.

Expected behavior
I expect the video file to have the correct length listed and to finish along with the playback head.

Console errors
If applicable, add a screenshot of the errors displayed in the console of your browser (F12) or your terminal.

Package versions:

unsure which version of the package i'm using, happy to provide if someone shows me how to find htis

Rendering select sections causes broken video files

Describe the bug
When rendering using ffmpeg, if you have a range selected that is less than the full video, the output mp4 will still be the length of the full animation, and when you attempt to scrub past the time that your selected parts take video playback fails. I'm no expert of ffmpeg but I'm guessing that you allocate the video to it's full length and then only fill in the selected frames.

To Reproduce

  1. Create a project and add some placeholder content
  2. Select a range that is less than the full length of the project
  3. Render as a video (my settings were 60fps, fast start, include audio, sRGB, 1.0x scale)
  4. Scrub to near the end of the video, past when your selected range would've ended.

Expected behavior
The video file should only be as long as the selected range.

Package versions:

  • core: 3.10.0
  • two: 3.10.1
  • ui: 3.10.0
  • vitePlugin: 3.10.0

Export/render to PDF

Description
Conference talks (e.g. for the CNCF) are often required to submit a PDF version of their slides to the event for accessibility reasons.
If Motion Canvas can generate PDFs, it will be much more useful/attractive for speakers.

Proposed solution
Motion canvas should provide a function that can be called to mark the current view state for rendering to PDF and a way to easily generate a PDF from an animation using this function.

Considered alternatives
Motion Canvas could export the first or last frame of each beginSlide slide, but these represent the animation waiting for user input which is not the same thing as a "complete" slide for rendering to a document.

Additional context
I am personally interested in using Motion Canvas for future WebAssembly (Wasm) talks like this one I gave at CloudNativeSecurityCon which I had to upload this PDF of slides for. Inherently PDF export will be lossy, but that's fine as long as users have the tools to select what snapshots best represent the flow of their talk.

GIF exporter

Description
Motion Canvas is a fantastic tool for creating quick animations, particularly useful for explainer visualizations. I can easily imagine myself making a quick animation to illustrate a point in a conversation as long as it doesn't take me more than 5-10 mins to make.

Sharing such an animation in a Slack / Discord message, or a documentation article, as a video is a bit of an overkill. A GIF is the most convenient format - it's small, embedded and autoplayed on most platforms.

Exporting a GIF from a Motion Canvas project is not necessarily difficult, but you have to know how to do it, and it takes extra steps, making the whole experience less appealing.

Proposed solution
Extend the FFMPEG exporter to offer an option to save as a GIF.
Utilise the best practices of creating GIF animations (like framerate and pallet generation).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.