Top Related Projects
Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
JavaScript animation engine
The motion graphics toolbelt for the web
Quick Overview
Animator is a lightweight JavaScript animation library developed by Haiku Team. It provides a simple and efficient way to create smooth animations for web applications, focusing on performance and ease of use.
Pros
- Lightweight and fast, optimized for performance
- Easy to use API with a gentle learning curve
- Supports both CSS and JavaScript animations
- Compatible with modern browsers and frameworks
Cons
- Limited documentation and examples available
- Smaller community compared to more established animation libraries
- May lack some advanced features found in larger animation libraries
- Not actively maintained (last commit was over 2 years ago)
Code Examples
Creating a simple animation:
import { animate } from '@haiku/animator';
animate('#myElement', {
translateX: '100px',
opacity: 0.5
}, {
duration: 1000,
easing: 'easeInOutQuad'
});
Chaining multiple animations:
import { animate } from '@haiku/animator';
animate('#myElement', { scale: 1.5 })
.then(() => animate('#myElement', { rotate: '45deg' }))
.then(() => animate('#myElement', { translateY: '50px' }));
Using keyframes for complex animations:
import { animate } from '@haiku/animator';
animate('#myElement', [
{ translateX: 0, opacity: 1 },
{ translateX: '100px', opacity: 0.5 },
{ translateX: '200px', opacity: 0 }
], {
duration: 2000,
easing: 'linear'
});
Getting Started
To use Animator in your project, follow these steps:
-
Install the package:
npm install @haiku/animator -
Import and use in your JavaScript file:
import { animate } from '@haiku/animator'; animate('#myElement', { translateX: '100px', opacity: 0.5 }, { duration: 1000 }); -
Make sure to have the target element in your HTML:
<div id="myElement">Animate me!</div>
Competitor Comparisons
Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
Pros of Lottie-web
- Wider adoption and community support
- Extensive documentation and examples
- Supports multiple platforms (web, iOS, Android)
Cons of Lottie-web
- Larger file size and potentially higher performance overhead
- Limited to animations created in Adobe After Effects
- Steeper learning curve for designers unfamiliar with After Effects
Code Comparison
Lottie-web:
lottie.loadAnimation({
container: document.getElementById('lottie-container'),
renderer: 'svg',
loop: true,
autoplay: true,
path: 'animation.json'
});
Animator:
import { Animator } from '@haiku/core';
new Animator({
element: document.getElementById('animator-container'),
component: require('./animation.js'),
loop: true
});
Both libraries aim to simplify the process of adding complex animations to web projects. Lottie-web focuses on converting After Effects animations to web-ready formats, while Animator provides a more code-centric approach to creating and managing animations. Lottie-web has a larger user base and more extensive documentation, but Animator offers a potentially more flexible and lightweight solution for developers who prefer working directly with code.
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
Pros of GSAP
- More mature and widely adopted animation library with extensive documentation and community support
- Offers a wider range of animation capabilities, including complex timelines and advanced easing functions
- Better performance for complex animations, especially on older browsers
Cons of GSAP
- Steeper learning curve due to its extensive feature set
- Larger file size, which may impact load times for smaller projects
- Commercial license required for some advanced features and use cases
Code Comparison
GSAP:
gsap.to(".box", {duration: 2, x: 100, y: 50, rotation: 360});
Animator:
Haiku.animate(".box", {
"2s": { transform: "translate(100px, 50px) rotate(360deg)" }
});
Summary
GSAP is a more powerful and versatile animation library with a larger ecosystem, while Animator offers a simpler API and is more focused on UI animations. GSAP is better suited for complex animations and projects requiring broad browser support, whereas Animator may be preferable for simpler animations or projects already using the Haiku ecosystem.
JavaScript animation engine
Pros of Anime
- Lightweight and fast, with a small file size (less than 17KB)
- Extensive documentation and examples available
- Supports a wide range of animation properties and easing functions
Cons of Anime
- Less focus on SVG-specific animations compared to Animator
- May require more manual setup for complex animations
- Limited built-in support for timeline-based animations
Code Comparison
Anime:
anime({
targets: '.element',
translateX: 250,
rotate: '1turn',
duration: 800,
easing: 'easeInOutQuad'
});
Animator:
const animation = new Animator({
element: '.element',
duration: 800,
easing: 'easeInOutQuad',
properties: {
translateX: 250,
rotate: 360
}
});
animation.play();
Both libraries offer similar functionality for basic animations, but Animator provides a more object-oriented approach with its Animator class. Anime uses a more functional style with its main anime() function.
Anime tends to be more popular and widely used, with a larger community and more frequent updates. However, Animator may be a better choice for projects heavily focused on SVG animations or those requiring more complex timeline-based animations.
The motion graphics toolbelt for the web
Pros of mojs
- More mature and established project with a larger community
- Extensive documentation and examples available
- Supports complex animations with custom easing functions
Cons of mojs
- Steeper learning curve for beginners
- Less integrated with modern web development workflows
- Requires more code for simple animations
Code Comparison
mojs:
const burst = new mojs.Burst({
radius: { 0: 100 },
count: 5,
children: {
shape: 'circle',
fill: { 'cyan': 'yellow' },
duration: 2000
}
});
Animator:
const animation = new Animator.Animation({
target: '.circle',
duration: 2000,
properties: {
radius: [0, 100],
fill: ['cyan', 'yellow']
}
});
Both libraries offer powerful animation capabilities, but mojs provides more granular control over complex animations at the cost of simplicity. Animator focuses on ease of use and integration with modern web development practices, making it more accessible for beginners and simpler projects. The code comparison demonstrates that mojs requires more setup for similar animations, while Animator offers a more straightforward API for basic tasks.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Haiku Animator
Haiku Animator is a design tool for creating Lottie animations and interactive web components. It's popular among enterprise motion design teams, digital creative studios, and animation classrooms.
Some features:
- Free-transform canvas for visual vector editing
- Visual timeline for keyframe animations
- Exporters for Lottie animations, GIFs, and videos
- Asset-linking from Figma, Illustrator, or Sketch
- Spreadsheet-like property "Expressions" for interactions and animations
- Code editors for interactive element actions & raw project source
Installation
ð Install the latest build from here: https://github.com/HaikuTeam/animator/releases/ ð
ð» Or run from source by following the Development instructions below. ð»
Development
1. Install OS dependencies
It's important to use precise minor version numbers where specified. nodegit/node-gyp build errors are expected if you ignore this.
Mac OS dependencies
1.) nvm:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
2.) node 8.15.1:
$ nvm install 8.15.1 && nvm alias default 8.15.1 && nvm use 8.15.1
3.) yarn 1.13.0:
$ curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
4.) python 2.7.16 (if you need multiple Python environments on your machine, we recommend pyenv)
5.) libgcrypt (required for nodegit native bindings) $ brew install libgcrypt
Windows OS dependencies
Assuming a clean Windows 10, open a PowerShell with admin rights:
# Install Chocolatey package manager
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install git
choco install git python2 -y
# Install nodejs
choco install nodejs-lts -y --version 8.15.1
# Ignore dependencies to force using specified node version
choco install yarn -y --version 1.13.0 --ignore-dependencies
# Update PowerShell environment vars
refreshenv
# Install windows build tools (to compile native electron modules, e.g. nodegit)
npm install -g windows-build-tools@2.3.0
In Windows is not possible to login in Figma while running Animator in development. In order to connect with Figma, is needed to set an environment variable called FIGMA_TOKEN with a Figma token as value.
If the app fails to start because of wrong precompiled binaries, try re-building them (can take some time)
yarn electron-rebuild
Linux OS dependencies
- Install a desktop environment like Gnome, XFCE, or KDE if machine does not already have one
- Install dependences from system repositories:
apt install git curl python2 build-essential libgcrypt20 libcurl4-openssl-dev libssl-dev libgtk-3-0 libgconf-2-4 libnss3 - Install nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash - Install node 8.15.1:
nvm install 8.15.1 && nvm alias default 8.15.1 && nvm use 8.15.1 - Install yarn 1.13.0:
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
2. Install project dependencies
After you clone the repository, simply run:
$ yarn install && yarn setup
3. Start development server
Assuming you've done the initial setup, you can start all the dev servers with:
$ yarn start
You can also skip the interactive prompt and start with good defaults with:
$ yarn go
You can also set some overriding environment variables (e.g. HAIKU_API) by making a .env file in the mono root. Refer to .env.example for an example.
Watching changes
For the compiler to watch for changes as you develop, run the following command in a separate Terminal tab:
$ yarn watch-all
Before committing
First lint all of the code:
$ yarn lint-all
Then run the unit tests in all of the code:
$ yarn test-all
You might also want to run:
$ yarn compile-all
Assuming no lint errors or test failures, push your changes:
$ git push # and create a pull request
Debugging
There are configurations included here for debugging any of the UI directly from inside VS Code.
You must install the Debugger for Chrome VS Code extension to use these. (cmd + shift + p, "install extensions", "Debugger for Chrome")
To debug, first launch mono normally (see Starting) â then from VS Code's left-side Debug menu, select attach-glass, attach-timeline, or attach-creator. You can then place breakpoints, explore stack traces, explore local values (and more) from inside VS Code.
In general, Plumbing can be debugged on port 9221 and Electron renderer processes can be debugged on port 9222.
Profiling
To add profile to any code, you should call
logger.time('<user defined name>')
<code to be profiled>
logger.timeEnd('<user defined name>')
And it will output
<timestamp>|<process>|info|d=149|<user defined name>
with d being duration between logger.time and logger.timeEnd. To do a subsequent profile with same name, you should call logger.time rearm again.
Contributing
Create a PR, file an issue, or join the Slack community with this invite link.
License
Every project you create with Haiku Animator is entirely yours, to license or sell or publish however you'd like.
This project's source code is licensed AGPL.
Status of this project
Animator was developed commercially for several years under Haiku Systems Inc., a software startup based in San Francisco, California with a team spread across the world. This code was open-sourced in August 2021 when Haiku shut down the commercial collaboration/storage services connected to Haiku Animator. Previously available features like publishing & sharing links have been removed.
Our hope is that open-sourcing Haiku Animator allows it to be even more useful, to more people (it's free), and lesfor longer (open source).
This project is open to new maintainers. This codebase isn't perfect. In fact, in its current state it has deep flaws. That said, to a dedicated tinkerer, it has potential. We created it chasing a dream of creative empowerment â we open-source it in hopes of that dream continuing on.
Read more at https://www.haikuanimator.com/
Top Related Projects
Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
JavaScript animation engine
The motion graphics toolbelt for the web
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot