Motion Canvas v3.15.0
New features ๐โ

A brand-new
Codenode with dedicated code signals, customizable syntax highlighting, and more expressive animation system (Including automatic diff-based transitions).
#946Press play to preview the animationimport ...
export default makeScene2D(function* (view) {
const code = createRef<Code>();
view.add(
<Code
ref={code}
fontSize={28}
fontFamily={'JetBrains Mono, monospace'}
offsetX={-1}
x={-400}
code={'const number = 7;'}
/>,
);
yield* waitFor(0.6);
yield* all(
code().code.replace(code().findFirstRange('number'), 'variable', 0.6),
code().code.prepend(0.6)`function example() {\n `,
code().code.append(0.6)`\n}`,
);
yield* waitFor(0.6);
yield* code().selection(code().findFirstRange('variable'), 0.6);
yield* waitFor(0.6);
yield* all(
code().code('const number = 7;', 0.6),
code().selection(DEFAULT, 0.6),
);
});
New
withDefaultshelper function lets you quickly extend nodes with your own defaults.
#982import {Txt, withDefaults} from '@wangyaoshen/locus-2d';
export const MyTxt = withDefaults(Txt, {
fill: 'rgba(255, 255, 255, 0.6)',
fontFamily: 'JetBrains Mono',
fontSize: 28,
});
When using
loop, the iteration count can be omitted to create an infinite loop:
#952// These two are equivalent:
yield* loop(() => { /* animation */ });
yield* loop(Infinity, () => { /* animation */ });
New
spawnfunction lets you run animations in the background, from any place, without needing to
#951yieldthem.
Polygonnow extends
Curvegiving it access to all curve-related properties like
startArrowand
radius.
#961
Color fields in the editor now come with a visual color picker.
#962
New
Vector2methods: #985

New
cardinalPointmethod lets you map
Origins and
Directions to their corresponding cardinal points of the node.
#988
New
waitTransitionlets you animate transitions using nodes.
#983
When passed to OpenGL,
Matrix2Dis now converted to a 3x3 square matrix (as opposed to a 3x2 matrix)
#984
The view's
cachePaddingis now respected when calculating the cache size of individual nodes.
#986
Presentation Mode now supports PowerPoint shortcuts (Page Up, Page Down, etc.)
#993
Parts of the motion-canvas-player shadow root are now exposed using
#956partand can be customized with CSS.
Fiddles on this website now play automatically when scrolled into view.
#1001
Fixed bugs ๐โ

Account for italic fonts in cache.
#968
Fix typo in the Quickstart Guide.
#974
Properly handle
#987offsetwhen retrieving the absolute position of a node.
Fix the spline warning for reactive points.
#981
Check out the Update Guide for information on how to update your existing projects.