movy.js

movy.js 是一个客户端 JS 动画引擎,用于创建解说视频。「movy.js is a client-side JS animation engine for creating explanatory videos.」

Github星跟踪图

logo

movy.js is an intuitive animation engine for creating explanatory videos.

gallery

Getting Started

Make sure you have node.js (version >= 12) installed on your computer.

  1. Install movy.js by: npm i movy@latest -g
  2. Run movy to open a list of examples (example animations are located in the movy/examples folder):

examples

  1. To create a new animation, simply run movy hello.js. It will automatically create a new animation file hello.js (if the file does not exist):
import * as mo from "movy";

mo.addText("Hello, Movy!", {
  scale: 0.8,
  color: "yellow",
}).grow();

Note: Modifying the source code will automatically refresh the browser.

  1. Click "Render" button to render the animation to a video file: xxx.webm

Add objects into the scene

To add new objects, you can use mo.add___(). For example:

Method Comment Preview
mo.addCircle() Add a circle
mo.addRect() Add a rect
mo.addTriangle() Add a triangle
... ... ...

Customize objects

All methods above can take extra named arguments for customization. For example, to set the object color and scale, you can use

mo.addTriangle({ color: "yellow", scale: 0.5 });

This will create a half-sized yellow triangle.

Furthermore, you can pass

More shapes

Besides, you can use mo.add___Outline() methods to create outlined shapes. For example:

Method Comment Preview
mo.addCircleOutline() Add circle outline.
mo.addRectOutline() Add rect outline.
mo.addTriangleOutline() Add triangle outline.
... ... ...

All named arguments mentioned in the previous section still works for these outlined shapes. Moreover, you can pass

Add animations

For each added scene object, you can call, e.g. obj.fadeIn(), obj.reveal(), obj.grow(), etc. to add different animations.

const rect = mo.addRect();

rect.grow();  // This will add grow animation to the circle object.

The following table lists the common animations supported by movy.js.

Customize animations

All animations can take following parameters for customization.

Note that some animation can take extra parameters. For example, you can pass { direction: 'down' } in obj.reveal() to specify the direction from which the object reveals.

Combining animations

By combining existing animations with some parameter tweaking, we can derive more complicated and beautiful animations.

mo.addRectOutline()
  .reveal()
  .moveTo({ rz: Math.PI * 4, duration: 2 })
  .fadeOut();

主要指标

概览
名称与所有者rossning92/movy
主编程语言TypeScript
编程语言JavaScript (语言数: 4)
平台
许可证MIT License
所有者活动
创建于2021-01-18 23:54:21
推送于2023-04-01 18:56:57
最后一次提交2022-09-25 09:50:01
发布数0
用户参与
星数1.3k
关注者数20
派生数158
提交数428
已启用问题?
问题数23
打开的问题数16
拉请求数1
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?