Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hm21/ngx-image-hero

A package to implement hero animations, allowing users to click on images and smoothly zoom them into a larger, immersive view, enhancing the user experience and interaction with images.
https://github.com/hm21/ngx-image-hero

angular angular2 animation hero image zoom

Last synced: 4 months ago
JSON representation

A package to implement hero animations, allowing users to click on images and smoothly zoom them into a larger, immersive view, enhancing the user experience and interaction with images.

Awesome Lists containing this project

README

        

Angular Image-Hero Animation

[![npm version](https://badge.fury.io/js/ngx-image-hero.svg)](https://badge.fury.io/js/ngx-image-hero)
[![NPM monthly downloads](https://img.shields.io/npm/dm/ngx-image-hero.svg)](https://badge.fury.io/js/ngx-image-hero)
[![NPM total downloads](https://img.shields.io/npm/dt/ngx-image-hero.svg)](https://badge.fury.io/js/ngx-image-hero)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Issues](https://img.shields.io/github/issues/hm21/ngx-image-hero)](https://github.com/hm21/ngx-image-hero/issues)
[![Web Demo](https://img.shields.io/badge/web-demo---?&color=0f7dff)](https://ngx-hm21.web.app/image-hero)


Demo Website


This package is similar to the popular Flutter Hero animations.

## Table of contents

- [About](#about)
- [Getting started](#getting-started)
- [Documentation](#documentation)
- [Example](#example)
- [Contributing](#contributing)
- [License](LICENSE)

## About

A package to implement hero animations, allowing users to click on images and smoothly zoom them into a larger, immersive view, enhancing the user experience and interaction with images.

## Getting started

### Installation

```sh
npm install ngx-image-hero
```

### Import the directive

```typescript
import { Component } from "@angular/core";
import { NgxImageHeroDirective } from "ngx-image-hero";

@Component({
selector: "app-root",
standalone: true,
templateUrl: "./app.component.html",
styleUrl: "./app.component.scss",
imports: [NgxImageHeroDirective],
})
export class AppComponent {}
```

Documentation

### Inputs

| Option | Type | Default | Comment |
| :----------------- | :------------ | :--------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| highQualityPath | string | | The path to the high-quality image or content to be displayed, which seamlessly replaces the current picture when opened. |
| fixedHero | boolean | false | Specifies whether to use the fixed-hero mode when absolute positioning is not effective due to overflow issues. |
| supportedFormats | string[] | | An array of supported image formats, which is only required when using the `` element where the browser automatically selects the format. |
| backdropPosition | 'documentEnd' | 'beforeHeroItem' | 'documentEnd' | Insert backdrop at this position. |
| browserSupportAvif | boolean | | If you have already manually determined whether the browser supports AVIF, you can set it using this option. Otherwise, the package will automatically perform the check. This option is only required when `supportedFormats` contains values. |
| browserSupportWebP | boolean | | If you have already manually determined whether the browser supports WebP, you can set it using this option. Otherwise, the package will automatically perform the check. This option is only required when `supportedFormats` contains values. |

### Outputs

| Option | Type | Comment |
| :-------- | :------------------- | :---------------------------------------- |
| openHero | EventEmitter\ | Triggered when the hero animation starts. |
| closeHero | EventEmitter\ | Triggered when the hero animation ends. |

Example

#### Simple example

```html
demo-image
```

#### Complete example demonstrating all properties

```html

@for (format of imgFormats; track format) {

}
demo-image

```

## Contributing

I welcome contributions from the open-source community to make this project even better. Whether you want to report a bug, suggest a new feature, or contribute code, I appreciate your help.

### Bug Reports and Feature Requests

If you encounter a bug or have an idea for a new feature, please open an issue on my [GitHub Issues](https://github.com/hm21/ngx-image-hero/issues) page. I will review it and discuss the best approach to address it.

### Code Contributions

If you'd like to contribute code to this project, please follow these steps:

1. Fork the repository to your GitHub account.
2. Clone your forked repository to your local machine.

```bash
git clone https://github.com/hm21/ngx-scroll-animations.git
```