@elm/ngx-animations

November 29, 2025 Β· View on GitHub

🎨 Next-Level Animation Library for Angular

Production-ready β€’ Lightweight β€’ High-performance β€’ RTL Support

Angular 18+ TypeScript MIT License PRs Welcome


✨ What is @elm/ngx-animations?

A complete, production-ready Angular animation library inspired by GSAP but optimized specifically for Angular applications. Built with Angular 18+ standalone components, it provides a rich set of animation directives, components, and a powerful timeline service for creating stunning UI animations.

🎯 Key Features

  • πŸš€ High Performance - Optimized with RAF and CSS animations
  • πŸ“¦ Standalone Components - Full Angular 18+ architecture
  • 🌍 RTL Support - First-class Arabic and Hebrew support
  • πŸŽͺ GSAP-like Timeline - Chain animations with ease
  • πŸ’ͺ TypeScript First - Complete type safety
  • πŸ“± Mobile Friendly - Smooth on all devices
  • πŸͺΆ Lightweight - Zero dependencies, tree-shakeable
  • β™Ώ Accessible - Respects prefers-reduced-motion

πŸ“¦ Installation

npm install @elm/ngx-animations

πŸš€ Quick Start

import { Component } from '@angular/core';
import { FadeInDirective, SlideInDirective } from '@elm/ngx-animations';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [FadeInDirective, SlideInDirective],
  template: `
    <div ngxFadeIn [duration]="500">
      <h1>Fade In Animation!</h1>
    </div>

    <div ngxSlideIn direction="left" [triggerOnScroll]="true">
      <p>Slides in when you scroll!</p>
    </div>
  `
})
export class AppComponent {}

πŸ‘‰ See QUICKSTART.md for a 5-minute getting started guide!


🎨 What's Included?

Animation Directives (6)

DirectiveDescription
ngxFadeInSmooth fade in/out animations
ngxSlideInSlide from any direction with RTL support
ngxScaleInScale animations from any origin
ngxRotateIn3D rotation on any axis
ngxParallaxScrollSmooth parallax scrolling
ngxRippleClickMaterial Design ripple effect

Animation Components (4)

ComponentDescription
<ngx-scroll-reveal>Reveal content on scroll
<ngx-stagger-list>Stagger list item animations
<ngx-typewriter>Typewriter effect with RTL
<ngx-marquee>Continuous scrolling content

Services (1)

ServiceDescription
TimelineServiceGSAP-like timeline for chaining animations

πŸ“š Documentation

πŸ“– Core Documentation

πŸ€– AI Assistant Integration

  • AI Assistant Docs (src/app/docs/ai-assistant): Ready-to-use prompts for tools like ChatGPT, Claude, or Copilot to generate Angular examples using @elm/ngx-animations.
  • Use with any LLM: Describe the motion you want (fade on scroll, bounce + rotate, performance tips, interaction-driven slides), then paste one of the provided prompts to get tailored code.

πŸš€ Publishing & Development


πŸ’‘ Examples

Hero Section Animation

<ngx-stagger-list animation="slide-up" [staggerDelay]="150">
  <h1 class="hero-title">Welcome to Our Site</h1>
  <p class="hero-subtitle">Next-level animations</p>
  <button class="hero-cta">Get Started</button>
</ngx-stagger-list>

Card Grid with Scroll Reveal

@for (card of cards; track card.id) {
  <ngx-scroll-reveal animation="scale" [delay]="$index * 50">
    <div class="card">
      <h3>{{ card.title }}</h3>
      <p>{{ card.content }}</p>
    </div>
  </ngx-scroll-reveal>
}

Typewriter Effect (with RTL Support)

<!-- English -->
<ngx-typewriter 
  [text]="'Welcome to next-level animations!'"
  [speed]="50"
  [showCursor]="true">
</ngx-typewriter>

<!-- Arabic (RTL) -->
<ngx-typewriter 
  [text]="'Ω…Ψ±Ψ­Ψ¨Ψ§ Ψ¨ΩƒΩ… في Ω…ΩƒΨͺΨ¨Ψ© Ψ§Ω„Ψ±Ψ³ΩˆΩ… Ψ§Ω„Ω…ΨͺΨ­Ψ±ΩƒΨ©'"
  [rtl]="true"
  [speed]="50">
</ngx-typewriter>

Timeline Animation (GSAP-like)

import { Component, inject, viewChild, ElementRef } from '@angular/core';
import { TimelineService } from '@elm/ngx-animations';

@Component({
  template: `
    <div #box1>Box 1</div>
    <div #box2>Box 2</div>
    <div #box3>Box 3</div>
  `
})
export class AnimationDemo {
  private timeline = inject(TimelineService);
  private box1 = viewChild<ElementRef>('box1');
  private box2 = viewChild<ElementRef>('box2');
  private box3 = viewChild<ElementRef>('box3');

  ngAfterViewInit() {
    const tl = this.timeline.create({ repeat: true });
    
    tl.to(this.box1()!, { opacity: '1', transform: 'translateX(100px)' }, 500)
      .to(this.box2()!, { opacity: '1', transform: 'scale(1.5)' }, 300)
      .parallel((ptl) => {
        ptl.to(this.box2()!, { transform: 'rotate(45deg)' }, 400);
        ptl.to(this.box3()!, { opacity: '1' }, 400);
      })
      .play();
  }
}

🎬 Demo Application

This project includes a comprehensive demo application showcasing all components and directives.

Live Demo: ngx-animations on Vercel

Run the Demo

# Install dependencies
npm install

# Serve the demo app
npm start

# Open browser to http://localhost:4200

The demo application includes:

  • βœ… All 11 animation components/directives
  • βœ… RTL examples (Arabic/Hebrew)
  • βœ… Timeline demonstrations
  • βœ… Interactive examples
  • βœ… Performance best practices

πŸ› οΈ Development

Build the Library

# Development build
npm run build:lib:dev

# Production build
npm run build:lib

# Watch mode
npm run watch:lib

Test Locally

# Build and pack
npm run build:lib
npm run pack:lib

# Install in another project
npm install /path/to/elm-ngx-animations-1.0.0.tgz

Publish to NPM

# Dry run (test without publishing)
npm run publish:lib:dry

# Actual publish
npm run publish:lib

See Publishing Guide for detailed instructions.


🌍 RTL Support

All components fully support RTL layouts for Arabic, Hebrew, and other right-to-left languages.

Automatic Detection

<div dir="rtl">
  <div ngxSlideIn direction="left">
    <!-- Automatically adjusts for RTL -->
    Ω…Ψ­ΨͺΩˆΩ‰ عربي
  </div>
</div>

Explicit RTL

<div ngxSlideIn direction="left" [rtl]="true">
  Forces RTL behavior
</div>

β™Ώ Accessibility

Respecting User Preferences

@Component({
  template: `
    <div ngxFadeIn [duration]="animationDuration">
      Content
    </div>
  `
})
export class MyComponent {
  animationDuration = window.matchMedia('(prefers-reduced-motion: reduce)').matches 
    ? 0 
    : 600;
}

πŸ“Š Performance Tips

  1. Use triggerOnScroll for below-the-fold content
  2. Prefer transform and opacity over other CSS properties
  3. Use will-change CSS property for complex animations
  4. Adjust threshold for intersection observer optimization
<div ngxFadeIn 
     [triggerOnScroll]="true" 
     [threshold]="0.5">
  Only animates when 50% visible
</div>

πŸ—‚οΈ Project Structure

animation-lib/
β”œβ”€β”€ projects/
β”‚   └── elm/
β”‚       └── ngx-animations/          # Library source
β”‚           β”œβ”€β”€ src/
β”‚           β”‚   β”œβ”€β”€ lib/
β”‚           β”‚   β”‚   β”œβ”€β”€ directives/  # Animation directives
β”‚           β”‚   β”‚   β”œβ”€β”€ components/  # Animation components
β”‚           β”‚   β”‚   └── services/    # Timeline service
β”‚           β”‚   └── public-api.ts    # Public exports
β”‚           β”œβ”€β”€ docs/                # Documentation
β”‚           β”‚   β”œβ”€β”€ API.md
β”‚           β”‚   β”œβ”€β”€ USAGE_GUIDE.md
β”‚           β”‚   └── PUBLISHING.md
β”‚           β”œβ”€β”€ README.md
β”‚           β”œβ”€β”€ CHANGELOG.md
β”‚           └── package.json
β”œβ”€β”€ src/
β”‚   └── app/
β”‚       └── demo/                    # Demo application
└── README.md                        # This file

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Guidelines

  1. Follow the existing code style
  2. Write tests for new features
  3. Update documentation
  4. Add examples to demo app

πŸ“„ License

MIT Β© 2025 elm By Banan Aladmari

See LICENSE for details.


πŸ™ Acknowledgments

Inspired by:

  • GSAP - For animation API patterns
  • Framer Motion - For modern animation concepts
  • Angular Community - For continuous support

πŸ“ž Support


πŸ—ΊοΈ Roadmap

  • Path-based animations
  • Morphing animations
  • Gesture-based animations
  • Physics-based spring animations
  • 3D transforms
  • More easing functions
  • Animation presets library

⭐ Show Your Support

If you find this library helpful, please consider:

  • ⭐ Starring the repository
  • 🐦 Sharing on social media
  • πŸ“ Writing a blog post
  • 🀝 Contributing to the project

Made with ❀️ for the ELM Angular community

Quick Start β€’ Full Docs β€’ API Reference β€’ Publish Guide