Animatopy
repository·master·Indexed 42 days ago
https://github.com/sarthology/animatopyA utility tool providing ready-to-use code snippets for the animate.css library, allowing developers to select and copy specific animations without importing the entire library. Version 1.0.0.
What's inside Animatopy
- Animatopy is a tool designed to provide easy access to animate.css snippets. Instead of downloading the entire library, users can select specific animations and copy the necessary code directly.
Install and run Animatopy locally
masterAnimatopy provides snippets for the animate.css library. To run the project locally for development, ensure you have Node and Webpack installed, then follow these steps:
- Install dependencies:
npm install - Start the development server:
npm start - Access the application at
http://localhost:8080
npm install npm start- Install dependencies:
Build Animatopy for production
masterTo create a production build of the project, use the following command:
npm run buildHow animations are applied and cleaned up
masterAnimations in Animatopy are applied by appending the animation name and the
animatedclass to a target element's class list. To ensure animations can be re-triggered, theanimationendevent listener is used to reset the element'sclassNameto an empty string once the animation finishes.Implementation Pattern:
const testAnim = (x) => { animationSandbox.className = " "; animationSandbox.classList += x + ' animated'; animationSandbox.addEventListener('animationend', (e) => { e.currentTarget.className = " "; }, false); };Trigger Animatopy animations and view CSS
masterThe
js/index.jsentrypoint manages the interactive sandbox for Animatopy. It allows users to select an animation from a dropdown (.js--animations) or click a trigger (.js--triggerAnimation) to apply the animation to a sandbox element (#animationSandbox).When an animation is triggered:
- The animation class and the
animatedclass are added to the sandbox element. - The
animationendevent is used to clean up the classes once the animation completes. - The corresponding CSS rules are extracted from
animate.jsonand displayed in a code block using PrismJS. - The required HTML structure is displayed in a separate code block.
// Conceptual usage based on the entrypoint logic: // 1. Select an animation name (e.g., 'fade-in') // 2. Apply to element: animationSandbox.classList.add('fade-in', 'animated'); // 3. The system automatically cleans up after completion: animationSandbox.addEventListener('animationend', (e) => { e.currentTarget.className = " "; }, false);- The animation class and the