Created by Tom Wilson / @twilson63
In this talk we will discuss the new ngAnimate module for AngularJS 1.2.0
The ngAnimate module is a separate ngModule maintained by the core AngularJS team.
provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time.
#delay1 {
position: relative;
transition-property: font-size;
transition-duration: 4s;
transition-delay: 2s;
font-size: 14px;
}
#delay1:hover {
transition-property: font-size;
transition-duration: 4s;
transition-delay: 2s;
font-size: 36px;
}
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
The @keyframes CSS at-rule lets authors control the intermediate steps in a CSS animation sequence by establishing keyframes (or waypoints) along the animation sequence that must be reached by certain points during the animation.
https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes
$( "#clickme" ).click(function() {
$( "#book" ).animate({
opacity: 0.25,
left: "+=50",
height: "toggle"
}, 5000, function() {
// Animation complete.
});
});
This content will enter and leave
/* starting animations */
.my-special-animation.ng-enter {
-webkit-transition:0.5s linear all;
-moz-transition:0.5s linear all;
-o-transition:0.5s linear all;
transition:0.5s linear all;
background:red;
}
/* destination animations */
.my-special-animation.ng-enter.ng-enter-active {
background:blue;
}
The .ng-enter and .ng-enter-active CSS classes are generated and appended to the element by AngularJS when the ngIf tells it that it's adding a new item into the repeat list. Depending on the animation, other CSS classes are added. Here's a breakdown of which directives add which CSS classes.
Using bower
bower install angular-animate --save
# index.html
Using CDN
# index.html
angular.module('App', ['ngAnimate'])
See the Pen zGgxH by Tom Wilson (@twilson63) on CodePen
See the Pen EeLxg by Tom Wilson (@twilson63) on CodePen
See the Pen awEue by Tom Wilson (@twilson63) on CodePen
See the Pen kimIp by Tom Wilson (@twilson63) on CodePen
For more information check out! Year of Moo Blog