【发布时间】:2021-10-18 21:05:28
【问题描述】:
我得到了我想要的动画,但它并没有从我想要的地方开始。文本应该从行中“出来”,现在它还没有做到这一点。 https://jsfiddle.net/bfth5w1k/
.text {
margin: 100px;
width: 500px;
height: 100px;
position: absolute;
}
h1{
font-size: 80px;
line-height: 200px;
width: 600px;
position: absolute;
bottom: 0;
left: 80px;
opacity:1;
}
h2{
font-size: 70px;
line-height: 30px;
width: 600px;
position: absolute;
bottom: 0;
left: 80px;
opacity:0;
}
h3{
font-size: 60px;
line-height: 150px;
width: 600px;
position: absolute;
bottom: 0;
left: 80px;
opacity:0;
}
.line {
position: absolute;
width: 500px;
left: 80px;
height: 5px;
background-color: white;
}
gsap.from(".line", { width: 0, duration: 0.3 });
gsap.from("h1",{height:0,duration:3,delay:0.3,opacity:0})
gsap.to("h2",{height:0,duration:3,delay:0.3,opacity:1})
gsap.to("h3",{height:0,duration:3,delay:0.3,opacity:1})
我想不通,也许 css 需要一些调整?
【问题讨论】:
-
"文本应该'出来'行" - 你的意思是说,对于任何越界的文本,任何部分都应该是在它开始的线的一侧不可见,只有在它们越线时才能看到?
-
是的。这就是我的意思,而且文本应该在动画开始时已经在那个交叉点,所以动画的一半不会浪费在不可见的文本上。