nuxt.js 使用nuxt-gsap-module,还没滑动到相应的位置,动画已执行,并覆盖遮挡到其他模块
html
<section class="panel orange">
<p><span class="line line-2"></span></p>
</section>
js
mounted() {
this.$wow()
const gsap = this.$gsap
gsap.registerPlugin(this.$ScrollTrigger);
gsap.from(".line-2", {
scrollTrigger: {
trigger: ".orange",
scrub: true,
pin: true,
start: "top top",
end: "+=100%",
},
scaleX: 0,
transformOrigin: "left center",
ease: "none"
});
}
css
.panel p {
color: black;
font-weight: 400;
text-align: left;
font-size: 0.8em;
line-height: 1.5em;
margin: 0.3em 0 1em 0;
width: 100%;
}
.orange {
background-color: #e77614;
background-image: radial-gradient(circle at 46% 40%, rgba(228, 228, 228,0.06) 0%, rgba(228, 228, 228,0.06) 13%,transparent 13%, transparent 100%),radial-gradient(circle at 11% 41%, rgba(198, 198, 198,0.06) 0%, rgba(198, 198, 198,0.06) 19%,transparent 19%, transparent 100%),radial-gradient(circle at 52% 23%, rgba(14, 14, 14,0.06) 0%, rgba(14, 14, 14,0.06) 69%,transparent 69%, transparent 100%),radial-gradient(circle at 13% 85%, rgba(148, 148, 148,0.06) 0%, rgba(148, 148, 148,0.06) 44%,transparent 44%, transparent 100%),radial-gradient(circle at 57% 74%, rgba(232, 232, 232,0.06) 0%, rgba(232, 232, 232,0.06) 21%,transparent 21%, transparent 100%),radial-gradient(circle at 59% 54%, rgba(39, 39, 39,0.06) 0%, rgba(39, 39, 39,0.06) 49%,transparent 49%, transparent 100%),radial-gradient(circle at 98% 38%, rgba(157, 157, 157,0.06) 0%, rgba(157, 157, 157,0.06) 24%,transparent 24%, transparent 100%),radial-gradient(circle at 8% 6%, rgba(60, 60, 60,0.06) 0%, rgba(60, 60, 60,0.06) 12%,transparent 12%, transparent 100%),linear-gradient(90deg, #ff7600, #ff7600);
}
.panel {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-weight: 600;
font-size: 1.5em;
text-align: center;
color: white;
position: relative;
box-sizing: border-box;
padding: 10px;
}
.line {
width: 100%;
height: 300px;
margin: 0 0 10px 0;
position: relative;
display: inline-block;
background-color: rgba(255,255,255,1);
}