MyGit

v2.0.0

motion-canvas/motion-canvas

版本发布时间: 2023-02-04 21:18:00

motion-canvas/motion-canvas最新发布版本:v3.15.2(2024-04-02 12:23:21)

2.0.0 (2023-02-04)

Bug Fixes

Code Refactoring

Features

Reverts

BREAKING CHANGES

TweenFunction is now called InterpolationFunction. Individual functions are now called [type]Lerp instead of [type]Tween. For instance: colorTween is now colorLerp.

InterpolationFunction is now called TimingFunction. This name is better aligned with the CSS spec.

See the migration guide for more info.

Scene files no longer need to follow the pattern: [name].scene.tsx. When importing scenes in the project file, a dedicated ?scene query param should be used:

import example from './scenes/example?scene';

export default new Project({
  name: 'project',
  scenes: [example],
});

vite and @motion-canvas/vite-plugin packages are now required to build a project:

npm i -D vite @motion-canvas/vite-plugin

The following vite.config.ts file needs to be created in the root of the project:

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

export default defineConfig({
  plugins: [motionCanvas()],
});

Types exposed by Motion Canvas are no longer global. An additional motion-canvas.d.ts file needs to be created in the src directory:

/// <reference types="@motion-canvas/core/project" />

Finally, the bootstrap function no longer exists. Project files should export an instance of the Project class instead:

import {Project} from '@motion-canvas/core/lib';

import example from './scenes/example.scene';

export default new Project({
  name: 'project',
  scenes: [example],
  // same options as in bootstrap() are available:
* Animator.inferTweenFunction now returns deepTween,
which does not work exactly as before, though should be a viable
replacement in most cases.
* `scene.transition()` has been replaced by `useTransition`

Any use of slide transition must be updated from
```ts
yield* scene.transition(slideTransition());

to

yield* slideTranstion();

Any transitions must be rewritten to utilize useTransition.

Projects using KonvaScenes should import the patches manually at the very top of the file project:

import '@motion-canvas/core/lib/patches'
// ...
bootstrap(...);

getset import path has changed:

import {getset} from '@motion-canvas/core/lib/decorators/getset';

Scene files need to export a special SceneDescription object instead of a simple generator function.

The names of all public events now use the following pattern: "on[WhatHappened]". Example: "onValueChanged".

By default, importing images will now return their urls instead of a SpriteData object. This behavior can be adjusted using the ?img and ?anim queries.

They should be imported from @motion-canvas/core/lib/flow.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-02-04发行的版本