javascript - 在时间线 GSAP 中对补间进行分组
问题描述
我在 GSAP 论坛上问过同样的问题,但我猜它不是一个活跃的论坛。我确实在 GSAP 上遇到了一些困难,我想在时间线中对补间进行分组,而不是单独进行,前两个同时进行,然后是后两个,依此类推......我真的试着自己弄清楚,我添加了一个减延迟,但它无法与 ScrollMagic 一起正常工作,或者我无法使其工作。这是我的代码:
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 } );
非常感谢。
解决方案
感谢 GreenSock 的惊人文档,我找到了解决方案。我只是在每个补间的末尾添加一个位置参数(https://greensock.com/position-parameter )。在最后:
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 );
推荐阅读
- powershell - 从 Powershell ISE 运行脚本时如何绕过执行策略
- javascript - 使用 javascript 和 html 显示月份、日期和年份
- c++ - C++:使用指针作为私有成员变量而不破坏封装?
- python - 如何获取目录中每个文件的文件创建日期?(Python)
- angular - ElementRef 未定义
- android - Android Fragment:在ScrollView中垂直居中时内容顶部被切断
- python - Python - TypeError:'NoneType' 对象在 CodeWars 中不可迭代退出代码 - 它们是否相同?
- sql-server - 如何使用 GEOJson 文件和数据库中已存在的表进行连接?
- python - 使用 One vs. rest 分类器进行上/下采样
- memory - 跨内存页面的数据会发生什么?