简体   繁体   English

在时间轴GSAP中对补间进行分组

[英]Grouping Tweens in Timeline GSAP

I have asked the same question on the GSAP forum but it's not an active forum as here, I guess. 我想在GSAP论坛上提出了相同的问题,但我想这里不是一个活跃的论坛。 I do have some struggles on GSAP, I want to group the tweens in the timeline, rather than going individually, first two goes at the same time and then the second two and so on... I really try to figure out by myself, I add a minus delay but it's not working properly with ScrollMagic or I can't make it work. 我在GSAP上确实有些挣扎,我想在时间轴中对补间进行分组,而不是单独进行,前两个同时进行,然后再进行两个,依此类推...我真的想自己弄清楚,我添加了一个负延迟,但是它不能与ScrollMagic一起正常工作,或者无法使其正常工作。 Here is my code: 这是我的代码:

let controllerPerspectiveFirst = new ScrollMagic.Controller();
perspectiveTimeline = new TimelineMax();

perspectiveTimeline
    .to( '#as-perspective-bg--mountain--01', .4, { autoAlpha: .72, scaleY: .8, scaleX: .8, ease: Power4.easeOut } )
    .from( '#as-perspective-bg--mountain--02', .4, { scaleY: 1.4, scaleX: 1.4, autoAlpha: 0, ease: Power4.easeOut } )
    .to( '#as-perspective-bg--mountain--01', .4, { autoAlpha: 0, scaleY: 0, scaleX: 0, ease: Power4.easeOut } )
    .to( '#as-perspective-bg--mountain--02', .4, { width: '180vw', scaleY: .6, scaleX: .6, ease: Power4.easeOut } )
    .from( '#as-perspective-bg--desert', .4, { scaleY: 1.4, scaleX: 1.4, autoAlpha: 0, ease: Power4.easeOut } );

Thanks much. 非常感谢。

Thanks to the amazing documentation of GreenSock, I have found the solution. 感谢GreenSock令人惊叹的文档,我找到了解决方案。 I just add a position parameter ( https://greensock.com/position-parameter ) at the end of each tween. 我只是在每个补间的末尾添加一个位置参数( https://greensock.com/position-parameter )。 At the end: 在末尾:

let controllerPerspectiveFirst = new ScrollMagic.Controller();
    perspectiveTimeline = new TimelineMax();

    perspectiveTimeline
        .to( '#as-perspective-bg--mountain--01', .4, { autoAlpha: .72, scaleY: .8, scaleX: .8, ease: Power4.easeOut }, 0 )
        .from( '#as-perspective-bg--mountain--02', { scaleY: 1.4, scaleX: 1.4, autoAlpha: 0, ease: Power4.easeOut }, 0 )
        .to( '#as-perspective-bg--mountain--01', .4, { autoAlpha: 0, scaleY: 0, scaleX: 0, x: '-40vw', y: '-70vh', ease: Power4.easeOut }, 1 )
        .to( '#as-perspective-bg--mountain--02', .4, { width: '180vw', scaleY: .6, scaleX: .6, x: '-40vw', y: '-28vw', ease: Power4.easeOut }, 1 )
        .from( '#as-perspective-bg--desert', .4, { scaleY: 1.4, scaleX: 1.4, autoAlpha: 0, ease: Power4.easeOut }, 1 );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM