gpt4 book ai didi

css - 将 css 动画与变换相结合

转载 作者:行者123 更新时间:2023-11-28 03:43:09 25 4
gpt4 key购买 nike

是否可以将 css 转换与一些动画结合起来?

我有这个tarnsform

transform: translate(-10%, 0px); left: 0px;

可以很好地为 slider 向左、向右滚动设置动画

但我想添加一些淡入动画,从不透明度 0 到 1

最佳答案

如果我没理解错的话,你希望翻译和不透明度都包含在动画中使用这个:

div {
width: 100px;
height: 100px;
background: red;
animation-name: fromleft;
animation-delay: 0s;
animation-duration: 0.8s;
animation-fill-mode: backwards;
animation-timing-function: ease-out;
}

@keyframes fromleft {
0% {
transform: translateX(-100px);
opacity: 0;
}
100% {
transform: translateX(0px);
opacity: 1;
}
}
<div>

</div>

关于css - 将 css 动画与变换相结合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44110205/

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