Jump to content
Search Community

AngularJS integration

Guest
Moderator Tag

Go to solution Solved by Guest,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've installed GSAP on Bower for my Angular application, but I can't use it as a dependency. Indeed, it returns "TweenMax is not defined"? How to fix this?

angular.module('App').animation('.cds', [function() {
   return {
   enter : function(element) {
    
      TweenMax.to(element, 2, {opacity:0});
    
      }
   };
  }]); 
Link to comment
Share on other sites

We can't tell what the problem is from that code. Did you put it in a script tag like this?

<script src="bower_components/greensock/src/uncompressed/TweenMax.js"></script>

Upload your project, and I'll take a look.

 

But since you posted that code, I can go ahead and tell you that it's going to cause problems. You need to let Angular know when the animation is complete by calling done.

angular.module('App').animation('.cds', [function() {
 return {
 enter : function(element, done) {    
      TweenMax.to(element, 2, {opacity:0, onComplete: done });    
    }
  };
}]); 
  • Like 1
Link to comment
Share on other sites

  • Solution

I'm sorry for creating this useless topic. I realize that angular.animation is not a good away to animate with Greensock and I solved the problem by using Browserify. Therefore, I created a bundle.js with TweenMax and some angular directives inside. Thanks anyway for your replies.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...