@elm/ngx-animations
November 29, 2025 Β· View on GitHub
π¨ Next-Level Animation Library for Angular
Production-ready β’ Lightweight β’ High-performance β’ RTL Support
β¨ 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)
| Directive | Description |
|---|---|
ngxFadeIn | Smooth fade in/out animations |
ngxSlideIn | Slide from any direction with RTL support |
ngxScaleIn | Scale animations from any origin |
ngxRotateIn | 3D rotation on any axis |
ngxParallaxScroll | Smooth parallax scrolling |
ngxRippleClick | Material Design ripple effect |
Animation Components (4)
| Component | Description |
|---|---|
<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)
| Service | Description |
|---|---|
TimelineService | GSAP-like timeline for chaining animations |
π Documentation
π Core Documentation
- Quick Start Guide - Get started in 5 minutes
- Complete README - Full library documentation
- API Reference - Detailed API docs
- Usage Guide - Comprehensive examples
π€ 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
- Publishing Guide - How to publish to NPM
- Changelog - Version history
π‘ 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
- Use
triggerOnScrollfor below-the-fold content - Prefer
transformandopacityover other CSS properties - Use
will-changeCSS property for complex animations - Adjust
thresholdfor 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
- Follow the existing code style
- Write tests for new features
- Update documentation
- 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
- π Documentation
- π Issue Tracker
- π¬ Discussions
πΊοΈ 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
Quick Start β’ Full Docs β’ API Reference β’ Publish Guide