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 🙏

© 2025 – Pkg Stats / Ryan Hefner

my-angular-animation

v1.1.0

Published

Light-weight Angular library provides commonly used animations. Also, run your custom industry standard animations.

Downloads

7

Readme

my-angular-animation library

Commonly used animations for Angular applications

Run any custom industry standard animation too

This light-weight Angular library provides a component to create commonly used animations in Angular applications.

Installation

You can install the library via NPM.

npm i my-angular-animation

Usage

You can use the provided animate component in your Angular components.

The supported animations are:

Eg. to animate sliding from right to left, you can use the animate component with the slideLeft animation.

<animate [id]="animateId" 
         [animation]="animation" 
         [durationInSeconds]="durationInSeconds"
         [iterationCount]="iterationCount"
         (onAnimationTriggered)="animationTriggered()"> 
    <div>my content</div>    
</animate>
export class AppComponent {
  title = 'my-angular-animation';

  //Animation settings
  animateId = "myAnimation";
  animation = AnimateComponent.slideLeft;
  durationInSeconds = 5;
  iterationCount = 3;

  animationTriggered() {
    console.log("Animation Triggered.")
  }

}

You can have any markup inside the animate component. The animate component will animate the content based on the animation specified.

Set the iterationCount to 1 or more to play the animation only once or more. Default is 1. Set it to 0 to play the animation infinitely.

This animation will fire automatically when the component is rendered.

Triggering animation

If you want to trigger the animation manually in code, you can set the isManualTrigger property to true.

And, use a component instance reference (@ViewChild) to call the triggerAnimation method.

For eg. When the Search button is clicked, click event is fired. The search event handler method is called which triggers the animation.

<animate [id]="'myAnimation'" 
         [animation]="animation" 
         [durationInSeconds]="5"
         [isManualTrigger]="true"
         #searchResultsAnimation>
    <div>My search results content</div>
</animate>
export class AppComponent {

  @ViewChild('searchResultsAnimation') searchResultsAnimation;

  search() {
    //Load search data

    this.searchResultsAnimation.triggerAnimation();
  }
}

Triggering animation dynamically

You can use AnimateSettings class to set up your animation.

And, call the triggerAnimationDynamic method using @ViewChild, to run your animation.

This will reset your running animation, if any. Also, it will set the isManualTrigger property to true;

If you want to override the onAnimationTriggered event, you can create a provider and inject it into your component.

Then, wire it to a method in your component using subscribe.

export class AnimateSettings {
  animation: string = "";
  durationInSeconds?: number = 1;
  delayInSeconds?: number = 0;
  iterationCount?: number = 1;
  onAnimationTriggered?: OutputEmitterRef<void>;
}
@Component({
  .
  .
  providers: [
    {provide: OutputEmitterRef<void>, useFactory: () => {
      const output = new(OutputEmitterRef<void>);
      return output;
    }}
  ]
})
export class AppComponent {

  constructor(private onAnimationTriggeredDynamic: OutputEmitterRef<void>) {
    this.onAnimationTriggeredDynamic.subscribe(this.animationTriggeredDynamic);
  }

  animationTriggeredDynamic() {
    console.log("Animation Triggered Dynamic.");
  }  

  search() {
      //Load search data

      let settings: AnimateSettings = {
        animation: AnimateComponent.wobble,
        durationInSeconds: 3,
        delayInSeconds: 3,
        iterationCount: 0,
        onAnimationTriggered: this.onAnimationTriggeredDynamic
      };

      this.searchResultsAnimation.triggerAnimationDynamic(settings);
  }

}

Animate component properties

| Property | Description | | --- | --- | | id | Unique identifier for the animation. | | animation | The animation to apply. | | durationInSeconds | The duration of the animation in seconds. Default is 1. Accepts fractions. | | iterationCount | The number of times the animation should play. Default is 1. 0 for infinite. | | delayInSeconds | The delay (in seconds) before the animation starts. Default is 0. Accepts fractions.| | onAnimationTriggered | The event is fired after the animation has been triggered. | | isManualTrigger | Set to true to trigger the animation manually. Default is false. | | @ViewChild | Component instance reference to call the triggerAnimation and triggerAnimationDynamic methods. |

Run any custom industry standard animation

You can also run custom animations using the animate component.

Eg. say your custom animation is slide-right-left.

Just enter the animation name in the animation property.

<animate [id]="'myAnimation'" 
         [animation]="'slide-right-left'" 
         [durationInSeconds]="3"
         [iterationCount]="0">
    <div>My content</div>
</animate>

In the above example, the slide-right-left animation will be applied to the content inside the animate component.

The CSS for the custom animation should be defined in your application's CSS file (eg. styles.css).

/* Custom industry standard animation */

.slide-right-left {
    animation: var(--durationInSeconds) slide-right-left var(--iterationCount) var(--delayInSeconds);
    animation-fill-mode: forwards;
    width: 100%;
}

@keyframes slide-right-left {
    0% {
        margin-left: -100%;
    }

    50% {
        margin-left: 0%;
    }

    100% {
        margin-left: -100%;
    }
}

You can use the --durationInSeconds, --iterationCount and --delayInSeconds CSS variables to set the duration, iteration count and delay for the custom animation.

These CSS variables will be set by the animate component based on it's durationInSeconds, iterationCount and delayInSeconds properties.