在效果上更改 TweenMax 速度

Changing TweenMax Speed on effects

我对 GSAP 还很陌生。以下效果很好,背景图像之间会发生变化,但不确定如何加快速度,所以会快一点。

JavaScript:

var avatarAni = new TimelineMax({ paused: true, repeat: -1 });

    avatarAni.to(avatars, animDuration, {
        scaleX: 1.1,
        scaleY: 1.1,
        ease: Power3.easeIn,
        onComplete: onCompleteScaleIn
    });

    avatarAni.to(avatars, animDuration, {
        scaleX: 1.0,
        scaleY: 1.0,
        ease: Power3.easeOut
    });

    avatarAni.play();

animDuration 是你可以玩的变量。稍微降低它的值,.to() 补间将会更快。

否则,如果您不想更改单个补间值,可以使用 .timeScale() 属性 的 TimelineMax 实例它会加快 avatarAni 时间线本身。所以你可以这样做:

...
avatarAni.timeScale(2);
avatarAni.play();

documentation说:

Factor that's used to scale time in the animation where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc.