Chapter 13. Mo.js

mo.js is a JavaScript library devoted to motion for the web. It offers a declarative syntax for motion and the creation of elements for animation. Even though mo.js is still in beta, there are already a host of amazing features to play with. Its author, Oleg Solomka (otherwise known as LegoMushroom), creates incredibly impressive demos and tutorials for the library’s offerings that you should check out, but in this article we’ll run through a really quick overview of features and tutorials to get you started.

Base Premises

mo.js basically offers two ways to make something that moves. You can do what other libraries do and reach inside the DOM or SVG DOM and move it, or you can create a special mo.js object, which has some unique offerings. There are fundamental things available to both ways of working, such as custom path easing and timelines. The path easing and timelines also have pretty impressive working tools to make them easier to adjust while you’re working.


Depending on what you’re animating, the shapes and other objects that mo.js allows you to make might simplify your workflow. mo.js offers a declarative syntax that makes it very easy to create something on the fly.

Figure 13-1 and its corresponding example are basic demos of the syntax.

Figure 13-1. A simple shape with a lot of nice details, including absolute centering

The code for this ...

Get SVG Animations now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.