gpt4 book ai didi

html - 箭头动画移动端问题

转载 作者:太空宇宙 更新时间:2023-11-03 22:13:18 25 4
gpt4 key购买 nike

我尝试更改此箭头效果,从左向右移动,但它对我不起作用,任何人都知道如何正确地做到这一点

I used this tutorial

#arrowAnim {
display: flex;
justify-content: center;
align-items: center;
}

.arrow {
width: 34px;
height: 34px;
border: 0.5vw solid;
border-color: #3f97cd transparent transparent #428ac7;
-webkit-transform: rotate(45deg);
transform: rotate(135deg);
}

.arrowSliding {
position: absolute;
-webkit-animation: slide 4s linear infinite;
animation: slide 4s linear infinite;
}

.delay1 {
-webkit-animation-delay: 1s;
animation-delay: 1s;
}

.delay2 {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}

.delay3 {
-webkit-animation-delay: 3s;
animation-delay: 3s;
}

@-webkit-keyframes slide {
20% {
opacity: 1;
transform: translateX(9vw);
}
80% {
opacity: 1;
transform: translateX(-9vw);
}
100% {
opacity: 0;
transform: translateX(-15vw);
}
}

@keyframes slide {
20% {
opacity: 1;
transform: translateX(9vw);
}
80% {
opacity: 1;
transform: translateX(-9vw);
}
100% {
opacity: 0;
transform: translateX(-15vw);
}
}
<div id="arrowAnim">
<div class="arrowSliding">
<div class="arrow"></div>
</div>
<div class="arrowSliding delay1">
<div class="arrow"></div>
</div>
<div class="arrowSliding delay2">
<div class="arrow"></div>
</div>
<div class="arrowSliding delay3">
<div class="arrow"></div>
</div>
</div>

最佳答案

请在下面添加更新的 CSS,使其从左到右工作。

#arrowAnim {
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}

.arrow {
width: 5vw;
height: 5vw;
border: 2.5vw solid;
border-color: transparent black black transparent ;
transform: rotate(-45deg);
}


.arrowSliding {
position: absolute;
-webkit-animation: slide 4s linear infinite;
animation: slide 4s linear infinite;
}

.delay1 {
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
.delay2 {
-webkit-animation-delay: 2s;
animation-delay: 2s;
}
.delay3 {
-webkit-animation-delay: 3s;
animation-delay: 3s;
}

@-webkit-keyframes slide {
0% { opacity:0; transform: translateX(-15vw); }
20% { opacity:1; transform: translateX(-9vw); }
80% { opacity:1; transform: translateX(9vw); }
100% { opacity:0; transform: translateX(15vw); }
}
@keyframes slide {
0% { opacity:0; transform: translateX(-15vw); }
20% { opacity:1; transform: translateX(-9vw); }
80% { opacity:1; transform: translateX(9vw); }
100% { opacity:0; transform: translateX(15vw); }
}

关键是在变换后更改右侧和底部的边框颜色,并通过反转关键帧中的值来反转动画。这是笔的更新链接。

https://codepen.io/Shashank_bhatt1/pen/vYBoeKG

关于html - 箭头动画移动端问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58199482/

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