Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-animate

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-animate

AngularJS module for animations

  • 1.8.3
  • next
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
139K
decreased by-12.8%
Maintainers
1
Weekly downloads
 
Created

What is angular-animate?

The angular-animate package is an AngularJS module that provides support for JavaScript, CSS3 transition, and CSS3 keyframe animation hooks within your AngularJS applications. It allows you to create smooth, complex animations for various elements and states in your application.

What are angular-animate's main functionalities?

CSS-based animations

This feature allows you to define CSS classes for entering and leaving animations. The .ng-enter and .ng-leave classes are used to define the starting state of the animation, while the .ng-enter-active and .ng-leave-active classes define the end state.

/* CSS code */
.fade.ng-enter {
  transition: 0.5s linear all;
  opacity: 0;
}
.fade.ng-enter-active {
  opacity: 1;
}
.fade.ng-leave {
  transition: 0.5s linear all;
  opacity: 1;
}
.fade.ng-leave-active {
  opacity: 0;
}

JavaScript-based animations

This feature allows you to define animations using JavaScript. You can create custom animations for entering and leaving elements by manipulating their CSS properties and using jQuery's animate function.

// JavaScript code
angular.module('myApp', ['ngAnimate'])
  .animation('.slide', function() {
    return {
      enter: function(element, done) {
        element.css({
          position: 'relative',
          left: '-10px',
          opacity: 0
        });
        element.animate({
          left: '0px',
          opacity: 1
        }, 1000, done);
      },
      leave: function(element, done) {
        element.css({
          position: 'relative',
          left: '0px',
          opacity: 1
        });
        element.animate({
          left: '-10px',
          opacity: 0
        }, 1000, done);
      }
    };
  });

ngAnimate directive

The ngAnimate directive can be used to apply animations to elements within an AngularJS application. In this example, the .fade class is applied to each item in the ng-repeat directive, and the corresponding CSS animations are triggered when items are added or removed.

<div ng-app="myApp" ng-controller="myCtrl">
  <div ng-repeat="item in items" class="fade">
    {{item}}
  </div>
</div>

<script>
angular.module('myApp', ['ngAnimate'])
  .controller('myCtrl', function($scope) {
    $scope.items = ['Item 1', 'Item 2', 'Item 3'];
  });
</script>

Other packages similar to angular-animate

Keywords

FAQs

Package last updated on 07 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc