Introduction to ngFx for Angular animations

Scott Moss
InstructorScott Moss
Share this video with your friends

Social Share Links

Send Tweet
Published 9 years ago
Updated 5 years ago

ngFx is an amazing animation library built on top of ngAnimate using Greensock Animation Platform. This quick introduction will have you animating your Angular apps today.

[00:00] In this lesson, we're going to be using ngFx to add some nice animations to our Angular application. Over here, we have this list of repeated items. We're using this search box here as a filter. We're going to use ngFx to attach animations to the elements entering and leaving the page.

[00:15] To get started, we can bower install ngFx. Note that its dependencies include ngAnimate and also GSAP TweenMax JS. Once we have those script tags, we can head over to our application, add the module dependencies of ngFx and also ngAnimate here.

[00:33] To actually start using the animations, in our case, since we're using ng-repeat, we head over to the element that's being repeated over...That's this "li" element here...and attach the ngFx class names.

[00:43] ngFx uses the fx namespace for its CSS classes. Say we want to add a zoom animation. We can say, "fx-zoom-left." As we come over here and filter, we can see we get this nice zoom animation for the elements entering and leaving the page.

[01:00] We can also control the speed of our animations by saying, "fx-speed-" and any time in milliseconds. Let's slow things down and put "1300," 1.3 seconds. As we filter, we notice the animations are just a little slower here, but still pretty smooth.

[01:18] We can also control the easing of our animations with ngFx. We can say, "fx-easing-." Let's use a dramatic one, elastic. All the easings are defined with GSAP TweenMax. Here, as we filter, now we get this nice, rubber-band, elastic easing here for our animations.

[01:38] Zoom left is just one of many pre-defined animations in ngFx. Another one of my favorites is rotate clock. Let's speed things up a little bit and put 700. Let's change it from elastic to back. Now, if we come over here and start filtering, we get this nice rotation animation with a nice back easing here. That's ngFx.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today