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

ng-animate

v2.0.1

Published

A library of cool, reusable and flexible animations for Angular

Downloads

37,870

Readme

🌙 ng-animate

npm

ng-animate is a collection of cool, reusable and flexible animations for Angular. It implements all the animations in animate.css, but with the power and flexibility of Angular animations instead of CSS.

Demo

The demo of the animations is available at https://jiayihu.github.io/ng-animate/.

Usage

npm install ng-animate --save

Example

Import the animation from the package and pass it to your Angular component using useAnimation:

// my-component.component.ts
import { trigger, transition, useAnimation } from '@angular/animations';
import { bounce } from 'ng-animate';

@Component({
  selector: 'my-component',
  templateUrl: 'my-component.component.html',
  animations: [
    trigger('bounce', [transition('* => *', useAnimation(bounce))])
  ],
})
export class MyComponent {
  bounce: any;
}
<!-- my-component.component.html -->
<div [@bounce]="bounce"></div>

Note: Make sure to have included BrowserAnimationsModule in your AppModule and the web-animation.js polyfill.

It's also possible to import only a subset of the animations:

import { bounce } from 'ng-animate/lib/bouncing';

Animation params

All the animations provided by ng-animate support at least two optional params timing and delay to specify the animation duration and delay. Default value for timing is usually 1s and 0s for delay.
You can pass the params object using the Javascript API or within the component template:

@Component({
  selector: 'my-component',
  templateUrl: 'my-component.component.html',
  animations: [
    trigger('bounce', [transition('* => *', useAnimation(bounce, {
      // Set the duration to 5seconds and delay to 2seconds
      params: { timing: 5, delay: 2 }
    }))])
  ],
})
export class MyComponent {}

Using a template can achieve the same result, but you'll have access to the component context:

<div [@bounce]="{ value: bounce, params: { timing: myTiming || 5, delay: myDelay || 2 } }"></div>

Animations

All the animations are organized by their group. Many of them have additional params other than timing/delay: refer to Advanced Usage for more details. Nevertheless you can probably ignore them if you're happy with how they are by default.

Attention seekers

  • bounce
  • flash
  • pulse
  • rubberBand
  • shakeX
  • shakeY
  • headShake
  • swing
  • tada
  • wobble
  • jello
  • heartBeat

Back

  • backInDown

  • backInLeft

  • backInRight

  • backInUp

  • backOutDown

  • backOutLeft

  • backOutRight

  • backOutUp

Bouncing

  • bounceIn
  • bounceOut. Additional param: scale

The following bouncing animations have additional params a, b, c, d for translate

  • bounceInDown

  • bounceInLeft

  • bounceInRight

  • bounceInUp

  • bounceOutDown

  • bounceOutLeft

  • bounceOutRight

  • bounceOutUp

Fading

All fading animations have additional params fromOpacity, toOpacity for opacity transition and a, b for translate.

  • fadeIn

  • fadeInDown

  • fadeInLeft

  • fadeInRight

  • fadeInUp

  • fadeInDownBig

  • fadeInLeftBig

  • fadeInRightBig

  • fadeInUpBig

  • fadeOut

  • fadeOutDown

  • fadeOutLeft

  • fadeOutRight

  • fadeOutUp

  • fadeOutDownBig

  • fadeOutLeftBig

  • fadeOutRightBig

  • fadeOutUpBig

The following fading animations do not have a, b for translate but fromX,fromY,toX,toY instead.

  • fadeInTopLeft

  • fadeInTopRight

  • fadeInBottomLeft

  • fadeInBottomRight

  • fadeOutTopLeft

  • fadeOutTopRight

  • fadeOutBottomLeft

  • fadeOutBottomRight

Sliding

Sliding animations are basically fading animations without a change of opacity. They can also receive the same params.

  • slideInDown
  • slideInLeft
  • slideInRight
  • slideInUp
  • slideOutDown
  • slideOutLeft
  • slideOutRight
  • slideOutUp

Flippers

  • flip
  • flipInX
  • flipInY
  • flipOutX
  • flipOutY

LightSpeed

  • lightSpeedIn
  • lightSpeedLeft
  • lightSpeedIn
  • lightSpeedOut
  • lightSpeedOutRight (same as lightSpeedOut)
  • lightSpeedOutLeft

Rotating

All rotating animations have additional params fromOpacity, toOpacity for opacity transition, origin for transform-origin and degrees for rotate3d.

  • rotateIn
  • rotateInDownLeft
  • rotateInDownRight
  • rotateInUpLeft
  • rotateInUpRight
  • rotateOut
  • rotateOutDownLeft
  • rotateOutDownRight
  • rotateOutUpLeft
  • rotateOutUpRight

Specials

  • jackInTheBox
  • hinge
  • rollIn
  • rollOut

Zooming

  • zoomIn
  • zoomOut

The following zooming animations have additional params a, b for translate

  • zoomInDown

  • zoomInLeft

  • zoomInRight

  • zoomInUp

  • zoomOutDown

  • zoomOutLeft

  • zoomOutRight

  • zoomOutUp

Advanced params

Many of the animations support also other params like scale, fromOpacity, toOpacity and much more, allowing extremely flexible usage and customization if you're not happy with default values.

Single letters like a, b, c, d are used for the steps of some animations: a is the starting value, d is the ending.
The animated property they refer to depends on the animation and the direction: usually translate on axis Y from -Down/-Up, axis X for -Left/-Right.

useAnimation(bounceInDown, {
  params: {
    timing: 5,

    // Specify granular values for `translate` on axis Y during 'bounceInDown' 
    a: '-3000px',
    b: '25px',
    c: '-10px',
    d: '5px',
  }
})