Skip to content

Visualize Your Ideas With Code

docs: add 3.16.0 release (#1046)

Jacob87015e8323f9
diff --git a/packages/docs/blog/2024-05-16-camera.tsx b/packages/docs/blog/2024-05-16-camera.tsx
new file mode 100644
index 00000000..c6363b59
--- /dev/null
+++ b/packages/docs/blog/2024-05-16-camera.tsx
@@ -0,0 +1,47 @@
+import {Camera, Circle, Grid, Node, Rect, makeScene2D} from '@motion-canvas/2d';
+import {all, createRef} from '@motion-canvas/core';
+
+export default makeScene2D(function* (view) {
+ const camera = createRef<Camera>();
+ const rect = createRef<Rect>();
+ const circle = createRef<Circle>();
+
+ const scene = (
+ <Node>
+ <Grid stroke={'#fff1'} lineWidth={1} size="100%" spacing={25}>
+ <Rect ref={rect} fill={'#e6a700'} size={50} position={[50, -25]} />
+ <Circle ref={circle} fill={'#e13238'} size={50} position={[-50, 25]} />
+ </Grid>
+ </Node>
+ );
+
+ view.add(
+ <>
+ <Camera.Stage
+ scene={scene}
+ x={-200}
+ width={300}
+ height={200}
+ stroke={'#242424'}
+ lineWidth={4}
+ />
+ <Camera.Stage
+ cameraRef={camera}
+ scene={scene}
+ x={200}
+ width={300}
+ height={200}
+ stroke={'#242424'}
+ lineWidth={4}
+ />
+ </>,
+ );
+
+ yield* all(
+ camera().centerOn(rect(), 3),
+ camera().rotation(180, 3),
+ camera().zoom(1.8, 3),
+ );
+ yield* camera().centerOn(circle(), 2);
+ yield* camera().reset(1);
+});
diff --git a/packages/docs/blog/2024-05-16-effects.tsx b/packages/docs/blog/2024-05-16-effects.tsx
new file mode 100644
index 00000000..f5314af4
--- /dev/null
+++ b/packages/docs/blog/2024-05-16-effects.tsx
@@ -0,0 +1,12 @@
+import {makeScene2D} from '@motion-canvas/2d';
+import {createEffect, createSignal} from '@motion-canvas/core';
+
+export default makeScene2D(function* () {
+ const signal = createSignal(0);
+
+ createEffect(() => {
+ console.log('Signal changed: ', signal());
+ });
+
+ yield* signal(1, 2);
+});
diff --git a/packages/docs/blog/2024-05-16-vectors.tsx b/packages/docs/blog/2024-05-16-vectors.tsx
new file mode 100644
index 00000000..653627a7
--- /dev/null
+++ b/packages/docs/blog/2024-05-16-vectors.tsx
@@ -0,0 +1,7 @@
+// Before
+// prettier-ignore
+yield* node().position(node().position().add([200, 100]), 2);
+
+// Now
+// prettier-ignore
+yield* node().position.add([200, 100], 2);
diff --git a/packages/docs/blog/2024-05-16-version-3.16.0.mdx b/packages/docs/blog/2024-05-16-version-3.16.0.mdx
new file mode 100644
index 00000000..a2605f6c
--- /dev/null
+++ b/packages/docs/blog/2024-05-16-version-3.16.0.mdx
@@ -0,0 +1,82 @@
+---
+slug: version-3.16.0
+title: Motion Canvas v3.16.0
+description: Lights, Camera, Effects!
+authors: aarthificial
+---
+
+import Link from '@docusaurus/Link';
+import IssueGroup from '@site/src/components/Release/IssueGroup';
+import Issue from '@site/src/components/Release/Issue';
+import PR from '@site/src/components/Release/PullRequest';
+import Fiddle from '@site/src/components/Fiddle';
+import CodeBlock from '@theme/CodeBlock';
+import sourceCamera from '!!raw-loader!@site/blog/2024-05-16-camera';
+import sourceEffects from '!!raw-loader!@site/blog/2024-05-16-effects';
+import sourceVectors from '!!raw-loader!@site/blog/2024-05-16-vectors';
+
+<IssueGroup type={'feat'}>
+ <Issue user={'ksassnowski'}>
+ A brand-new{' '}
+ <Link to="/docs/camera">
+ <code>Camera</code>
+ </Link>{' '}
+ node with helper methods for zooming and focusing on elements:
+ <PR id={1019} />
+ <Fiddle
+ mode="preview"
+ ratio="3"
+ className="margin-top--sm margin-bottom--sm"
+ >
+ {sourceCamera}
+ </Fiddle>
+ </Issue>
+ <Issue user={'aarthificial'}>
+ New <Link to="/docs/effects">effects</Link> can be used to react to changes
+ in signals:
+ <PR id={1043} />
+ <CodeBlock language={'ts'} className="margin-top--sm margin-bottom--sm">
+ {sourceEffects}
+ </CodeBlock>
+ </Issue>
+ <Issue user={'mancopp'}>
+ All vector operations can now be used with vector signals for a more concise
+ code:
+ <PR id={1030} />
+ <CodeBlock language={'ts'} className="margin-top--sm margin-bottom--sm">
+ {sourceVectors}
+ </CodeBlock>
+ </Issue>
+ <Issue user={'aarthificial'} pr={1045}>
+ <Link to="/api/2d/components/Polygon#vertex">
+ <code>Polygon.vertex()</code>
+ </Link>{' '}
+ and{' '}
+ <Link to="/api/2d/components/Polygon#vertexCompletion">
+ <code>Polygon.vertexCompletion()</code>
+ </Link>{' '}
+ can be used to retrieve information about the vertices of a polygon.
+ </Issue>
+ <Issue user={'mancopp'} pr={1023}>
+ New example for the Code node.
+ </Issue>
+</IssueGroup>
+<IssueGroup type={'fix'}>
+ <Issue user={'aarthificial'} pr={1044}>
+ Handle invalid values for time events.
+ </Issue>
+ <Issue user={'aarthificial'} pr={1026}>
+ Fix the destination uv in shaders.
+ </Issue>
+ <Issue user={'Josephine19001'} pr={1039}>
+ Fix the type of the layout gap property.
+ </Issue>
+ <Issue user={'aarthificial'} pr={1025}>
+ Fix Code size calculation.
+ </Issue>
+</IssueGroup>
+
+<small>
+ Check out <Link to="/docs/updating">the Update Guide</Link> for information on
+ how to update your existing projects.
+</small>