大家好,我是 Just,这里是「设计师工作日常」,今天分享的是用 css 打造一个极简的列表块加载动效。
最新文章通过公众号「设计师工作日常」发布。
目录
整体效果
💎知识点:
1️⃣animation
动画
2️⃣flex
布局
3️⃣opacity
透明属性
🔑思路:
写好列表块整体布局,然后利用不同的动画时长调整变化透明度,来实现视觉上的列表正在加载的效果。
适用于 app 列表加载延迟等页面场景。
核心代码部分,简要说明了写法思路;完整代码在最后,可直接复制到本地运行。
核心代码
html 代码
html 搭建列表块整体布局。
css 部分代码
1、定义整体列表块通用样式,设置一个浅一点的背景色,设置
display: flex
布局。
2、利用
flex
布局,分别写出列表块中的每个小的矩形,并且设置相关的样式颜色等。
3、给列表块里的每个小的矩形设置
animation
动画,并且设置相关参数,每个动画时长递增0.2s
。
4、设置动画关键帧,定义变化
opacity
透明属性,让列表块中的小的矩形由浅到深循环变化,这样就形成了视觉上列表块内容在加载的效果。
完整代码如下
html 页面
css 样式
页面渲染效果
以上就是所有代码,以及简单的思路,希望对你有一些帮助或者启发。
我是 Just,这里是「设计师工作日常」,求点赞求关注!