{"id":1348,"date":"2026-07-10T18:05:05","date_gmt":"2026-07-10T11:05:05","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/10\/getting-started-with-motion-canvas-for-programmatic-animations\/"},"modified":"2026-07-10T18:05:05","modified_gmt":"2026-07-10T11:05:05","slug":"getting-started-with-motion-canvas-for-programmatic-animations","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/10\/getting-started-with-motion-canvas-for-programmatic-animations\/","title":{"rendered":"Getting Started with Motion Canvas for Programmatic Animations"},"content":{"rendered":"<h1>Getting Started with Motion Canvas for Programmatic Animations<\/h1>\n<p>Motion Canvas is a TypeScript-based animation tool that lets you create high-quality motion graphics through code. Unlike traditional video editors, you script every element\u2014shapes, timelines, and transitions\u2014using JavaScript\/TypeScript syntax. This tutorial covers the essentials to build your first animation.<\/p>\n<h2>Setting Up Your First Project<\/h2>\n<p>Install Motion Canvas globally via Node.js: <code>npm install -g @motion-canvas\/cli<\/code>. Then create a new project: <code>npm init @motion-canvas@latest my-project<\/code>. Navigate into the folder and run <code>npm start<\/code> to launch the editor in your browser at <code>localhost:9000<\/code>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20use%20Motion%20Canvas%20for%20animations\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>Understanding Scene and Node Architecture<\/h2>\n<p>Every animation is composed of <strong>scenes<\/strong> (timeline sections) and <strong>nodes<\/strong> (visual elements). In <code>src\/scenes\/example.tsx<\/code>, define a scene:<\/p>\n<ul>\n<li>Use <code>makeScene2D<\/code> to create a scene function.<\/li>\n<li>Add nodes like <code>Circle<\/code>, <code>Rect<\/code>, or <code>Txt<\/code> inside a <code>&lt;View&gt;<\/code> component.<\/li>\n<li>Each node accepts properties such as <code>fill<\/code>, <code>size<\/code>, <code>position<\/code>, and <code>opacity<\/code>.<\/li>\n<\/ul>\n<h2>Adding Keyframe Animations<\/h2>\n<p>Motion Canvas uses generators for smooth transitions:<\/p>\n<h3>Basic movement<\/h3>\n<p><code>yield* circle().position.x(200, 1)<\/code> moves the circle 200px right over 1 second. The <code>*<\/code> after <code>yield<\/code> tells the runtime to wait for completion.<\/p>\n<h3>Chaining animations<\/h3>\n<p>Use multiple <code>yield*<\/code> calls sequentially, or combine with <code>all()<\/code> for parallel motion:<\/p>\n<p><code>yield* all(circle().opacity(0, 0.5), rect().scale(2, 0.5))<\/code> \u2013 both animations run simultaneously.<\/p>\n<h2>Exporting Your Animation<\/h2>\n<p>Stop the dev server (<code>Ctrl+C<\/code>) and run <code>npm run export<\/code>. The tool renders each scene as a series of PNG frames inside the <code>output<\/code> folder. Use FFmpeg or similar to stitch them into a video file. Alternatively, install <code>@motion-canvas\/ffmpeg<\/code> for direct video export.<\/p>\n<p>Motion Canvas gives you full programmatic control over every pixel. Start with simple shapes, experiment with generators, and build complex motion graphics entirely in code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting Started with Motion Canvas for Programmatic Animations Motion Canvas is a TypeScript-based animation tool that lets you create high-quality motion graphics through code. Unlike traditional video editors, you script every element\u2014shapes, timelines, and transitions\u2014using JavaScript\/TypeScript syntax. This tutorial covers the essentials to build your first animation. Setting Up Your First Project Install Motion Canvas &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-1348","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1348"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/1348\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}