我试图将背景图像向上缩放,然后又向下缩放,但是无法让它工作,任何想法? 它可以很好地扩展背景,但它就像从不调用“反向”功能一样?
TweenMax.to(bg, 1, {
css: {
scaleX: 1.5,
scaleY: 1.5,
transformOrigin: "center center",
onComplete: reverse,
onCompleteParams: [bg]
},
delay: 0.2,
ease: Power3.easeInOut
});
function reverse(el) {
TweenMaxto(el, 0.6, {
css: {
scaleX: 1.0,
scaleY: 1.0,
transformOrigin: "center center",
autoAlpha: 1,
},
ease: Power2.easeOut
});
}
答案 0 :(得分:0)
你需要在css:{}对象之外移动onComplete,onCompleteParams,如下所示,
TweenMax.to(bg, 1, {
css: {
scaleX: 1.5,
scaleY: 1.5,
transformOrigin: "center center"
},
onComplete: reverse,
onCompleteParams: [bg],
delay: 0.2,
ease: Power3.easeInOut
});
function reverse(el) {
alert("Sdasd");
TweenMaxto(el, 0.6, {
css: {
scaleX: 1.0,
scaleY: 1.0,
transformOrigin: "center center",
autoAlpha: 1,
},
ease: Power2.easeOut
});
}
检查fiddle
希望它有所帮助。