gpt4 book ai didi

css - 如何编写CSS关键帧来确定 Material 设计进度条

转载 作者:技术小花猫 更新时间:2023-10-29 11:25:44 25 4
gpt4 key购买 nike

我想制作一个不确定的进度条,如 material design (第二个)在网页中使用 CSS3。任何人都可以分享必要的 CSS 魔法吗?我希望它的行为与视频中的完全相同,所以一端正在加速,而另一端正在减速,直到它们切换。

我找不到任何可用这种方式工作的现有示例。

最佳答案

I found a good example by Stefano on CodePen :

// Android Material Loading animation with pure css. 
// Author: Stefano Ferrara http://androidpc.it/
// Forked from https://codepen.io/chofoo/pen/Abril
// Author: Simon Clavey https://simonclavey.co.uk/
body{
background:#ffffff;
margin:50px 300px;
}

.slider{
position:absolute;
width:1000px;
height:5px;
overflow-x: hidden;
}

.line{
position:absolute;
opacity: 0.4;
background:#4a8df8;
width:150%;
height:5px;
}

.subline{
position:absolute;
background:#4a8df8;
height:5px;
}
.inc{
animation: increase 2s infinite;
}
.dec{
animation: decrease 2s 0.5s infinite;
}

@keyframes increase {
from { left: -5%; width: 5%; }
to { left: 130%; width: 100%;}
}
@keyframes decrease {
from { left: -80%; width: 80%; }
to { left: 110%; width: 10%;}
}
<div class="slider">
<div class="line"></div>
<div class="subline inc"></div>
<div class="subline dec"></div>
</div>

许可证:

Copyright (c) 2016 by Stefano (https://codepen.io/shalimano/pen/wBmNGJ)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

关于css - 如何编写CSS关键帧来确定 Material 设计进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34773266/

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