This repository contains animation sequences for Dataforest's animations, created using a custom animation framework built on top of TypeScript. The animations are designed to be modular and reusable, allowing for easy integration into various projects.
Install the necessary dependencies by running:
npm installRun the development server with:
npm run devBuild the project for production with:
npm run buildThe following parts are required to use the animation in your project:
- SVG Markup: Include the SVG markup in your HTML file. You can find the SVG files in the
index.htmlwith each[data-js-canvas]Element. - Animate Library: Ensure that the Animate library
animejsis included in your project - Animation Script: Import the animation script into your project. The scripts are located in the
srcdirectory (e.g.,animation-001.ts,animation-002.ts). - Styles: Include the styles from
styles/_animate.cssto ensure proper rendering of the animations.
You can export the animations as MP4 videos using the following command:
npm run dev
npm run export:mp4or
npm run dev
npm run export:mp4:4kThe Frames are temporarily stored in the ./frames folder and the resulting MP4 file is saved as the ./out.mp4 file.
This script uses Puppeteer to capture frames of the animation (from export-canvas.html) and FFmpeg to compile them into an MP4 file. Make sure you have FFmpeg installed on your system via e.g.
brew install ffmpegTo update the animation FPS, width, and height, you can set the following environment variables before running the export command:
FPS: Frames per second (default: 24)WIDTH: Width of the output video in pixels (default: 1080)HEIGHT: Height of the output video in pixels (default: 1920)CRF: Constant Rate Factor for video quality (default: 18)
To change to animation you have to update the export-canvas.html file in the / folder and the export-canvas.ts file in the src/ folder.