Angular ngAnimate,ng-view使动画不起作用

时间:2017-05-27 08:46:51

标签: javascript angularjs ng-animate gsap

角度版本:1.6.1

我正在尝试为我的ng-view元素进行淡入/淡出。问题是只有输入动画才有效。

html部分:

<main class="main" ng-view></main>

app.js

App.animation('.main', function() {
        return {
            enter : function(element, done) {
                TweenMax.set(element,{autoAlpha:0});
                TweenMax.to(element, .4, {autoAlpha: 1, ease: Quad.easeOut, delay: 1});
                done();
            },

            leave : function(element, done) {
                TweenMax.to(element, .4, {autoAlpha: 0, ease: Quad.easeOut});
                done();
            }
        };
    });

提前致谢,感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:0)

            enter : function(element, done) {

                TweenMax.to(element, .4, {autoAlpha: 1, ease: Quad.easeOut, delay: 1, onComplete:done});

            },

            leave : function(element, done) {
                TweenMax.to(element, .4, {autoAlpha: 0, ease: Quad.easeOut, onComplete:done});

            }

css || .main:opacity:0;