我使用一些内联 svg 作为剪辑路径和 AOS 库制作了这个动画部分。这个想法是用不同的动画为图像的每个切片设置动画。此标记有效并且支持 IE10+。但我真的不明白如何让这个部分响应,我的意思是,如果屏幕的宽度低于 svg 的固定宽度,我怎样才能使整个部分适应屏幕的 100%(或更好的 90%)。请至少帮助我一个起点。非常感谢
这是一个工作的代码笔(滚动动画在代码笔框中效果不佳,因此您必须上下调整框的大小以测试动画)
AOS.init();
.sezione-cta {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-end;
height: 50px;
margin: 100px 0 250px 0;
font-family: 'Raleway', sans-serif;
}
.cta-image-container svg{
position: absolute;
}
.cta-image-container {
width: 640px;
height: 580px;
margin: 0 25px 0 25px;
filter: drop-shadow(6px 6px 7px rgba(0,0,0,0.5));
position: relative;
}
.cta-image {
max-width: 100%;
max-height: 100%;
position: absolute;
}
.svg-cta-image {
width: 640px;
height: 580px;
}
.cta-image-1-3 {
clip-path: url(#split-1-3);
}
.cta-image-2-3 {
clip-path: url(#split-2-3);
}
.cta-image-3-3 {
clip-path: url(#split-3-3);
}
.cta-image-container:after {
content: 'VIAGGIA';
position: absolute;
top: 0;
left: 80px;
font-size: 250px;
font-weight: 600;
line-height: 0.5;
z-index: 0;
color: #000;
text-shadow: 6px 6px 7px rgba(0,0,0,0.5);
}
.sezione-cta .cta-text {
width: 350px;
margin: 0 25px -10px 25px;
}
.sezione-cta h3 {
font-size: 35px;
margin: 0;
font-weight: 400;
}
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<svg class="split-defs" style="position:absolute;"><defs>
<clipPath id="split-1-3"><polygon points="222,580 0,580 0.12,0 176,0"></polygon></clipPath>
<clipPath id="split-2-3"><polygon points="400,0 196,0 242,580 446,580"></polygon></clipPath>
<clipPath id="split-3-3"><polygon points="640,0 420,0 466,580 640,580"></polygon></clipPath>
<filter id="desaturate"><feColorMatrix type="saturate" values="0"></feColorMatrix>
</filter></defs></svg>
<div class="sezione-cta sezione-cta-viaggia">
<div class="cta-image-container aos-init aos-animate" data-aos="fade-right" data-aos-offset="0" data-aos-duration="2000" data-aos-easing="ease-in-out" data-aos-anchor-placement="bottom-bottom">
<div data-aos="fade-up" data-aos-easing="ease-in-out" data-aos-duration="1500" data-aos-anchor-placement="bottom-bottom" class="aos-init aos-animate">
<svg class="svg-cta-image"><image filter="url(#desaturate)" width="640" height="580" class="cta-image cta-image-1-3" xlink:href="https://anekitalia.com/wp-content/uploads/media/justfun-viaggi-evento-viaggia-split.jpg"></image></svg>
</div>
<div data-aos="fade-down" data-aos-easing="ease-in-out" data-aos-duration="1500" data-aos-anchor-placement="bottom-bottom" class="aos-init aos-animate">
<svg class="svg-cta-image"><image width="640" height="580" class="cta-image cta-image-2-3" xlink:href="https://anekitalia.com/wp-content/uploads/media/justfun-viaggi-evento-viaggia-split.jpg"></image></svg>
</div>
<div data-aos="fade-up" data-aos-easing="ease-in-out" data-aos-duration="1500" data-aos-anchor-placement="bottom-bottom" class="aos-init aos-animate">
<svg class="svg-cta-image"><image width="640" height="580" class="cta-image cta-image-3-3" xlink:href="https://anekitalia.com/wp-content/uploads/media/justfun-viaggi-evento-viaggia-split.jpg"></image></svg>
</div>
</div>
<div class="cta-text aos-init aos-animate" data-aos="fade-left" data-aos-offset="0" data-aos-duration="2000" data-aos-easing="ease-in-out"><h3>Per noi viaggiare significa <b>EMOZIONARSI</b>. Abbiamo gli ingredienti giusti per rendere <b>il tuo viaggio memorabile!</b></h3></div>
</div>