npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@omnedia/ngx-fade

v1.0.2

Published

A simple component library to add a (directional) fade effect to your elements.

Downloads

27

Readme

NgxFadeComponent

The NgxFadeComponent is a versatile Angular component that provides a smooth fading and sliding effect for its content as it enters or leaves the viewport. This component uses the IntersectionObserver API to detect when the component is in view and apply the defined transition effects. It's fully customizable with different transition directions, durations, and easing functions.

Features

  • Viewport Detection: Automatically fades and slides the content when it enters or leaves the viewport.
  • Flexible Directions: Supports transitions from different directions such as up, down, left, and right.
  • Custom Transforms: You can fully customize the transform property, overriding the default directional behavior.
  • Customizable Timing: Control the transition duration and easing function for smooth animations.

Installation

Install the component via npm:

npm install @omnedia/ngx-fade

Usage

Import the NgxFadeComponent in your module or component:

import { NgxFadeComponent } from '@omnedia/ngx-fade';

@Component({
  ...
  imports: [
    NgxFadeComponent,
    ...
  ],
  ...
})
export class YourComponent {}

Add the component to your template:

<om-fade [direction]="'up'" [transitionDuration]="'1s'" [transitionFunction]="'ease-out'">
  <p>Fading content from the bottom</p>
</om-fade>

Inputs

  • direction (optional): The direction from which the content should slide in. Accepts "up", "down", "left", or "right". The content will fade in from this direction. If a customTransform is provided, it will override this input.
  • transitionDuration (optional): The duration of the transition, specified as a valid CSS duration value (e.g., "1s", "500ms"). Default is "0.5s".
  • transitionFunction (optional): The easing function for the transition, specified as a valid CSS transition timing function (e.g., "ease-in-out", "linear"). Default is "ease-in-out".
  • customTransform (optional): A custom CSS transform value to override the direction behavior. If set, this custom transform will take precedence over the direction input.

Custom Transforms

If you want more control over how the element is transformed, you can use the customTransform input, which allows you to specify any CSS transform, such as rotating or scaling the element. This input overrides the direction setting.

<om-fade [customTransform]="'rotate(45deg)'" [transitionDuration]="'1s'">
  <p>Custom rotated content</p>
</om-fade>

In this example, instead of sliding the content in from a direction, it will appear with a 45-degree rotation.

Example

<om-fade [direction]="'left'" [transitionDuration]="'2s'" [transitionFunction]="'ease-in'">
    <h2>Fading In from Left</h2>
</om-fade>
<om-fade [customTransform]="'scale(0.5)'" [transitionDuration]="'1.5s'">
  <h2>Custom Scaling Effect</h2>
</om-fade>

How It Works

  • The component uses the IntersectionObserver API to monitor when the component enters or leaves the viewport.
  • Upon entering the viewport, the content will fade in and slide from the direction specified by the direction input (or use the custom transform if defined).
  • The transitionDuration and transitionFunction inputs allow you to fine-tune the animation timing.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.