Which animation tool is recommended? We hear this question very often in practice. Animation tools play a very important role in the creating process of a 3D configurator.
After working with a number of them, we can only say that there is no correct answer. It’s a complicated question and the answer is correspondingly complicated. In the following article we would like to clarify what you should use and when so that you can work with the right tool in every situation.
Of course we don’t have the possibility to go through every single animation library, so here we will focus on those that we have already used in practice and that are particularly interesting. Please note that these are our recommendations, which are based on our experience and may therefore differ from your experience.
Native Animation.
Before we talk about any libraries, let’s go through some native animation implementations.
CSS.
CSS remains one of our preferred ways to animate. We have been using it for years and are still excited about it because of its excellent performance. CSS animations allow the transition between different states using a number of keyframes.
Advantages:
Disadvantages:
requestAnimationFrame.
requestAnimationFrame (rAF) is a native method that is available on the Window object in JavaScript. It is very useful because it finds out what the right frame rate is for your animation in any environment you are in, and only drives it to that level. For example, if you are on a mobile device, the frame rate will not be as high as on the desktop. It also stops when a tab is inactive to prevent unnecessary use of resources. For this reason, requestAnimationFrame is a really high-performance way of animating and most of the libraries we will be dealing with use it internally. RequestAnimationFrame works in a similar way to recursion, before drawing the next frame in a sequence, it executes the logic and then calls itself again to continue. This may sound a little complex, but what it really means is that you have a set of commands that are executed all the time, so it will interpolate how the intermediate steps are represented very nicely for you.
Canvas is excellent for setting pixels in motion. So many of the impressive animations you see on CodePen are developed by canvas experts. As the name suggests, canvas provides visual space scripting where you can create complex drawings and high performance interactions. We work with pixels here, which means they are rasterized (as opposed to vectors).
Advantages:
Disadvantages:
SMIL.
SMIL is the native SVG animation specification. It allows them to move, morph, and even interact with SVGs directly in the SVG DOM. There are a lot of advantages and disadvantages to working with SMIL, but some factors will make us omit it altogether. It is increasingly losing acceptance.
Web Animations API.
The Web Animations API is native JavaScript that allows you to create complex sequential animations without loading external scripts. Or it will, as support grows. For now, you’ll probably need a polyfill. This native API was created as a backfill from all the great libraries and works that people have already done with JavaScript on the web. This is part of a movement that combines the power of CSS animation and the flexibility of sequencing in JavaScript under one roof.
Advantages:
Disadvantages:
WebGL.
There are some extraordinary things you can do with WebGL. If you’ve got something that’s socking you up, there’s a good chance it was created with WebGL. What it really does well are interactive 3D effects. Take a look at some demos. Technically it uses canvas.
Advantages:
Disadvantages:
External Libraries.
GreenSock (GSAP).
GreenSock is by far our favorite library we have worked with. Especially for SVG GSAP is recommended. The GreenSock Animation API has almost too many advantages to list you completely here. There are also good learning opportunities through forums and documents.
Advantages:
Disadvantages:
VelocityJS.
VelocityJS provides much of the sequencing that GreenSock does. We no longer use Velocity due to a number of disadvantages. The syntax of Velocity looks a bit like jQuery, so if you’ve already used jQuery, you’ll be familiar with it.
Advantages:
Disadvantages:
jQuery.
jQuery is not only an animation library, but also has animation methods and is used by more and more users.
Advantages:
Disadvantages:
Snap.svg
Many people think Snap is an animation library, but it was never intended to be one. We wanted to do performance benchmarks on Snap, but even Dmitri Baranovskij says here in the SVG Immersion Podcast that it’s not the right tool:
A little note from Baranovskij: “Snap is not an animation library and I always recommend to use it with GSAP if you need a serious animation”.
This means that jQuery doesn’t work well enough with SVG, although you now support class operations. If we have to do a DOM manipulation with SVG, Snap is really great for it.
A library called SnapFoo was recently released and it extends Snap’s realm for animation. I haven’t played it myself yet, but it looks pretty cool and is worth a try.
Mo.js
This is a library from a developer, which comes from LegoMushroom. It’s a highly talented animator and has already made some great demos for this library that really excited us. This library is still in beta and is very close to release.
Advantages:
Disadvantages:
Three.js
Three.js is a wonderful three-dimensional animation tool. We regularly use Three.js for the development of our real-time 3D configurators and have only had positive experiences with it so far.
Bodymovin
Bodymovin is intended for creating animations in Adobe After Effects that you can easily export to SVG and JavaScript. Some of the demos are really impressive. We don’t work with them because we really like them. Creating things from scratch with code, but if you’re more of a designer than a developer, you’ll really like it. The only disadvantage is that if you have to change something later, you have to export it again. This could be a strange workflow. Also, the code output is usually kind of big, but we didn’t see that it affects performance too much in the case of Bodymovin, so it’s probably fine.
React-specific workflows.
Before we go into React, let’s talk about why we need to treat animations differently in React. DOM stands for Document Object Model. We create a structured document with objects whose nodes we call a tree. React interacts with a virtual DOM, which is an abstraction unlike the native browser implementation.
React uses a number of virtual DOM reasons, the most compelling of which is the ability to find out what has changed and update only the parts it needs. This abstraction has its price and some of the old tricks you work with will give you trouble in a React environment. For example, iQuery will work fine with React because the primary function is to interact and manipulate with the browser’s native DOM. We have even seen some strange CSS race conditions.
React Motion.
React Motion is a very popular way to animate in React, and the community has adopted it through the old ReactCSSTransitionGroup, which used to be the most widely used.
React Motion is very similar to the playful animation where you give an element mass and physics and get it on its way and it arrives when it arrives. This means that you don’t specify a time span as you do with CSS or other traditional web-based sequential movements. This is a completely different way of thinking about animation. This can mean that the motion has the ability to look really realistic, which can be very nice. But user interfaces have different requirements than games, so working with them can be difficult. Let’s say you have two things that have to fire independently and get there at the same time that are different. It can be difficult to fine-tune them.
Until recently, there was no sequencing. Just last week Cheng Lou added Lou to onRest, which makes this kind of callback workflow possible. It is still not easy to write a loop without writing an infinite loop. You may not need this, but we thought it should at least not go unmentioned at this point. As FYI for the performance sensitive it uses rendering.
Advantages:
Disadvantages:
GSAP in React.
GreenSock has so much to offer that it is still worth using it in a React environment. This is especially true for complex sequencing where React-Motion does not offer a lean solution and GreenSock shines. It takes a little more fine-tuning than usual and some things that should work and have to do with the DOM are not present in React.
CSS in React.
CSS-Animationen haben in letzter Zeit eine gewissen Wiederbelebung erfahren, da es der einfachste Weg ist, Animationen in React zu erstellen. Für kleine Animationen wir UI/UX-Interaktionen ist React hervorragend geeignet. Darüber hinaus eignen sie sich auch gut für kleine Anpassungen der Benutzeroberfläche.
Schlußfolgerungen.
Mit diesem Beitrag haben wir ihnen einen kurzen Überblick darüber gegeben, welche Technologien Sie für das Erstellen ihrer Animationen verwenden können. Es sind unsere persönlichen Erfahrungen, so dass andere Nutzer andere Erfahrungen gemacht haben können. Dennoch hoffen wir, ihnen einen ersten kurzen Überblick ermöglicht zu haben.
Vielen Dank für ihren Besuch.