gpt4 book ai didi

css - Greensock timelinemax steps不流畅

转载 作者:行者123 更新时间:2023-11-28 00:34:39 29 4
gpt4 key购买 nike

我必须在不同的步骤中进行剪辑路径转换。然而,在 greensock 中将 链接到 方法并没有提供我正在寻找的平滑度,因为它在样式之间卡住了几毫秒。这是我的代码:

const box = document.getElementById('box')

this.timeline = new TimelineMax({})
.to(box, 0, { clipPath: 'polygon(0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%)' })
.to(box, 1, { clipPath: 'polygon(20% 0%, 20% 0%, 0% 100%, 0% 100%, 0% 100%, 0% 0%)' })
.to(box, 1, { clipPath: 'polygon(40% 0%, 40% 0%, 20% 100%, 20% 100%, 0% 100%, 0% 0%)' })
.to(box, 1, { clipPath: 'polygon(100% 0%, 100% 0%, 80% 100%, 80% 100%, 0% 100%, 0% 0%)' })

最佳答案

你没有定义缓动,所以它使用默认的缓动,如果我是正确的,它是 Power1.easeOut,这将导致动画之间的暂停。

您可以通过设置覆盖默认的缓动

TweenLite.defaultEase : Power0.easeNone

或者这样写你的时间表:

this.timeline = new TimelineMax({})
.to(box, 0, { clipPath: 'polygon(0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%)' }, ease:"none")
.to(box, 1, { clipPath: 'polygon(20% 0%, 20% 0%, 0% 100%, 0% 100%, 0% 100%, 0% 0%)' }, ease:"none")
.to(box, 1, { clipPath: 'polygon(40% 0%, 40% 0%, 20% 100%, 20% 100%, 0% 100%, 0% 0%)' }, ease:"none")
.to(box, 1, { clipPath: 'polygon(100% 0%, 100% 0%, 80% 100%, 80% 100%, 0% 100%, 0% 0%)' }, ease:"none")

ease:"none"是新的 GSAP 3 语法。 ease:"Power0.easeNone"将是较旧的语法。

希望这能解决您的问题

关于css - Greensock timelinemax steps不流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54244059/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com