div+css模仿苹果手表图标滚动效果代码
代码语言:html
所属分类:加载滚动
代码描述:div+css模仿苹果手表图标滚动效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
}
html {
color-scheme: light dark;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
.box {
box-sizing: border-box;
border: 1px solid light-dark(black, white);
width: 400px;
height: 400px;
border-radius: 100px;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
row-gap: 16px;
overflow: auto;
}
.box::before, .box::after {
content: '';
display: block;
width: 100%;
height: 1px;
}
.profile {
position: relative;
background: grey;
width: 70px;
height: 70px;
border-radius: 50%;
animation-name: shrink-in-and-out;
animation-timeline: view();
animation-fill-mode: both;
transform-origin: 50% 50%;
/* animation-range: 10% entry 100%, exit -10%; */
}
.profile:nth-child(5n + 1),
.profile:nth-child(5n + 3),
.profile:nth-child(5n + 5) {
animation-name: sides;
top: 43px;
/* transform: translateY(calc(50% + 8px)); */
}
.hidden {
visibility: hidden;
}
/* @keyframes grow {
from {
scale: 0.1;
}
} */
@keyframes shrink-in-and-out {
entry 0%, entry 20% {
scale: 0.01;
opacity: 0;
translate: 0 -50%;
}
entry 150% {
scale: 1;
opacity: 1;
translate: 0 0;
}
exit 0% {
scale: 1;
opacity: 1;
translate: 0 0;
}
exit 80%, exit 100% {
scale: 0.01;
opacity: 0;
translate: 0 50%;
}
}
@keyframes sides {
entry 0%, entry 50% {
scale: 0.01;
opacity: 0;
translate: 0 -50%;
}
entry 150% {
scale: 1;
opacity: 1;
transl.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0