Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/utkarsh5026/mayonation

smol animation engine in TS 😎
https://github.com/utkarsh5026/mayonation

animation animation-library library nodejs typescript

Last synced: 1 day ago
JSON representation

smol animation engine in TS 😎

Awesome Lists containing this project

README

        

# ðŸŽĻ Mayonation

A lightweight and performant animation library for the web

[![Tests](https://github.com/utkarsh5026/mayonation/actions/workflows/test.yml/badge.svg)](https://github.com/utkarsh5026/mayonation/actions)
[![npm version](https://badge.fury.io/js/mayonation.svg)](https://www.npmjs.com/package/mayonation)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[Demo](https://utkarsh5026.github.io/mayosite/) â€Ē [Documentation](#-api-reference) â€Ē [Examples](#-examples)

## âœĻ Features

- ðŸŠķ **Lightweight** - Tiny footprint (<5kb gzipped)
- ðŸŽŊ **Simple API** - Intuitive chainable methods
- 🚀 **High Performance** - Optimized for 60fps animations
- ðŸŽŪ **Timeline Control** - Create complex animation sequences
- ðŸŽĻ **Flexible** - Animate CSS & SVG elements
- ðŸ“Ķ **TypeScript Ready** - Full type support included

## ðŸ“Ķ Installation

```bash
npm install mayonation
# or
yarn add mayonation
# or
pnpm add mayonation
```

## 🚀 Quick Start

### Timeline Animation

```typescript
import { timeline, animate } from 'mayonation'

// Sequential animations
timeline({ loop: true, precision: 1 })
.add(animate({
target: '.box1',
translateX: 100,
duration: 1000
}))
.add(animate({
target: '.box2',
scale: 2
}), '+=500') // Starts 500ms after previous
.add(animate({
target: '.box3',
opacity: 0
}), 2000) // Starts at 2000ms
.play()
```

### SVG Drawing Animation

```typescript
import { draw, trace } from 'mayonation'

// Draw SVG path
timeline()
.add(draw({
target: '#my-path',
duration: 1000
}))
.play()

// Trace SVG path
timeline()
.add(trace({
target: '#my-path',
duration: 1000
}))
.play()
```

## 🌟 Examples

### Basic Timeline

```typescript
timeline()
.add(animate({
target: '.element',
translateX: 100,
duration: 1000
}))
.play()
```

### SVG Animation

```typescript
timeline()
.add(draw({
target: '#svg-path',
duration: 2000
}))
.add(trace({
target: '#svg-path',
duration: 1000
}), '+=500')
.play()
```

## ðŸĪ Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## 📄 License

MIT ÂĐ [Utkarsh Priyadarshi](https://github.com/utkarsh5026)

---


Built with âĪïļ by Utkarsh Priyadarshi