Search by

avalynx / avalynx-animate

jschwind

AvalynxAnimate is a lightweight vanilla JavaScript animation library with scroll and visibility triggers.

Package info

github.com/avalynx/avalynx-animate

Language:JavaScript

pkg:composer/avalynx/avalynx-animate

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-12-02 15:53 UTC

This package is auto-updated.

Last update: 2026-12-02 15:57:53 UTC


README

npm version npm downloads Composer version Composer downloads jsDelivr License Tests codecov GitHub stars

AvalynxAnimate is a modern, lightweight, and easy-to-use animation library built with vanilla JavaScript — without any framework dependencies. Use scroll-position triggers for precise layout-based timing or visibility-observer triggers for animations that start when elements enter the viewport.

Features

  • Two trigger modes: trigger: 'scroll' calculates start points from layout position and offset (default 120); trigger: 'observer' starts at viewport entry and accepts rootMargin.
  • Modern Engine: one passive scroll handler coalesced per animation frame, ResizeObserver based recalculation when the layout changes, CSS custom properties for timing — and elements at the very end of a document still animate.
  • Progressive Enhancement: without JavaScript nothing is hidden — initial states are class-based, not attribute-based.
  • New Animations: blur-in*, pop*, tilt-in-*, roll-in-* and GPU-friendly clip-path masks (mask-wipe-*, mask-circle).
  • Reduced Motion: respects prefers-reduced-motion and shows content immediately.
  • DOM Observation: optional MutationObserver support animates elements added after init (observeDom: true).
  • Hover Animations: micro-interactions like shake, grow or pop on mouse over, via data-avalynx-animate-hover.
  • Lightweight: zero dependencies.

Examples

Installation

Include AvalynxAnimate in your HTML file:

<link rel="stylesheet" href="path/to/avalynx-animate.css">
<script src="path/to/avalynx-animate.js"></script>

Installation via jsDelivr (Link)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/avalynx-animate@1.0.0/dist/css/avalynx-animate.css">
<script src="https://cdn.jsdelivr.net/npm/avalynx-animate@1.0.0/dist/js/avalynx-animate.js"></script>

Installation via NPM (Link)

npm install avalynx-animate
import { AvalynxAnimate } from 'avalynx-animate';
import 'avalynx-animate/dist/css/avalynx-animate.css';

Installation via Symfony AssetMapper

php bin/console importmap:require avalynx-animate

Import the library and its stylesheet in your application entry point:

import { AvalynxAnimate } from 'avalynx-animate';
import 'avalynx-animate/dist/css/avalynx-animate.css';

Installation via Symfony AssetComposer

More information about the Symfony AssetComposer Bundle can be found here.

{% do addAssetComposer('avalynx/avalynx-animate/dist/css/avalynx-animate.css') %}
{% do addAssetComposer('avalynx/avalynx-animate/dist/js/avalynx-animate.js') %}

Installation via Composer (Link)

composer require avalynx/avalynx-animate
<link rel="stylesheet" href="vendor/avalynx/avalynx-animate/dist/css/avalynx-animate.css">
<script src="vendor/avalynx/avalynx-animate/dist/js/avalynx-animate.js"></script>

Usage

Auto init:

AvalynxAnimate.init({ duration: 600 });

Re-scan and recalculate after DOM or layout changes:

AvalynxAnimate.refresh();

Own instance with a custom selector:

new AvalynxAnimate('.my-animated', { observeDom: true });

Markup

<!-- Animation namespace -->
<div data-avalynx-animate="blur-in-up" data-avalynx-animate-delay="200"></div>

<!-- Scroll trigger: when the center reaches the bottom of the viewport -->
<div data-avalynx-animate="zoom-in" data-avalynx-animate-anchor-placement="center-bottom"></div>

<!-- Observer trigger, selected per element -->
<div data-avalynx-animate="fade-up" data-avalynx-animate-trigger="observer"></div>

Per-element options use the data-avalynx-animate-* namespace: duration, delay, easing, trigger, offset, anchor (selector of the element whose position triggers), anchor-placement, once and mirror. The global offset is only applied when an element defines neither its own offset nor its own anchor placement.

Animated elements receive the avalynx-animate-in class — use it for custom styles of the animated state.

Options

Defaults are optimized for layout-based scroll triggers.

  • duration: (number) Default animation duration in milliseconds (default: 400).
  • delay: (number) Default animation delay in milliseconds, applied when animating in (default: 0).
  • easing: (string) Default CSS timing function or named easing such as ease-out-back (default: 'ease').
  • trigger: (string) Trigger mode, 'scroll' or 'observer' (default: 'scroll'). May be overridden by data-avalynx-animate-trigger.
  • rootMargin: (string|number) Margin for the observer trigger in px or %; a single value (numbers are pixels) is applied to the bottom (default: '0px').
  • offset: (number) Offset in pixels from the original trigger point (default: 120).
  • anchorPlacement: (string) Which part of the element has to reach which line of the viewport: top-bottom, center-bottom, bottom-bottom, top-center, center-center, bottom-center, top-top, center-top or bottom-top (default: 'top-bottom').
  • once: (boolean) Animate only once and keep elements visible after entering (default: false).
  • mirror: (boolean) In observer mode, animate out after any exit; in scroll mode, animate out after passing the element (default: false, requires once: false).
  • disable: (boolean|'mobile'|function) Disable animations entirely, on small screens or when the function returns true (default: false).
  • respectReducedMotion: (boolean) Skip animations when the user prefers reduced motion (default: true).
  • observeDom: (boolean) Watch the DOM for added or removed elements and refresh automatically (default: false).
  • onAnimate: (function) Callback whenever an element has been animated in (default: null).

Trigger modes

The default 'scroll' mode calculates trigger points from the element's layout position, anchor placement and offset. It animates out while scrolling back above the trigger unless once: true; mirror: true also animates out after passing an element.

Choose 'observer' when actual viewport visibility should control the effect. Observer mode uses IntersectionObserver, accepts rootMargin, and by default animates out only when leaving below or to the right of the observer area; mirror: true animates out after every exit. If IntersectionObserver is unavailable or rejects the rootMargin, elements are shown immediately.

AvalynxAnimate.init({ trigger: 'observer', rootMargin: '0px 0px -20% 0px', once: true });

Content stays visible without JavaScript, reduced motion is respected, and the animated state uses the single avalynx-animate-in class. Layout changes are recalculated through ResizeObserver.

Animations

Classic set: fade, fade-up, fade-down, fade-left, fade-right, fade-up-right, fade-up-left, fade-down-right, fade-down-left, flip-left, flip-right, flip-up, flip-down, slide-up, slide-down, slide-left, slide-right, zoom-in, zoom-in-up, zoom-in-down, zoom-in-left, zoom-in-right, zoom-out, zoom-out-up, zoom-out-down, zoom-out-left, zoom-out-right.

New set: blur-in, blur-in-up, blur-in-down, blur-in-left, blur-in-right, pop, pop-up, pop-down, tilt-in-left, tilt-in-right, roll-in-left, roll-in-right, mask-wipe-left, mask-wipe-right, mask-wipe-up, mask-wipe-down, mask-circle.

Hover animations

Micro-interactions on mouse over — pure AvalynxAnimate, no extra CSS needed:

<!-- hover the card, only the image reacts -->
<div class="card" data-avalynx-animate-hover="shake" data-avalynx-animate-hover-target=".card-img-top">
    <img src="..." class="card-img-top" alt="...">
</div>

<!-- without a target the element itself reacts -->
<img src="..." alt="..." data-avalynx-animate-hover="grow">

One-shot effects (shake, jiggle, pop, bounce, tada, heartbeat) re-arm on every new hover, held states (grow, shrink) stay while hovering. Like all animations they respect prefers-reduced-motion.

Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request with your changes or improvements. We're looking for contributions in the following areas:

  • Bug fixes
  • Feature enhancements
  • Documentation improvements

Before submitting your pull request, please ensure your changes are well-documented and follow the existing coding style of the project.

License

AvalynxAnimate is open-sourced software licensed under the MIT license.

Contact

If you have any questions, feature requests, or issues, please open an issue on our GitHub repository or submit a pull request.