css实现2d与3d图标列表无限滚动动画切换效果代码
代码语言:html
所属分类:加载滚动
代码描述:css实现2d与3d图标列表无限滚动动画切换效果代码,右侧可配置参数和滚动速度。
代码标签: css 2d 3d 图标 列表 无限 滚动 动画 切换
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@font-face {
font-family: "Geist Sans";
src: url("//repo.bfw.wiki/bfwrepo/font/GeistVF.ttf") format("truetype");
}
*,
*:after,
*:before {
box-sizing: border-box;
}
:root {
--speed: 10s;
--transition: 0.15s;
}
body {
display: grid;
place-items: center;
min-height: 100vh;
color: hsl(0 0% 10%);
font-family: "Geist Sans", "SF Pro Text", "SF Pro Icons", "AOS Icons", "Helvetica Neue", Helvetica, Arial, sans-serif, system-ui;
background-image:
radial-gradient(at 27% 37%, hsla(215, 98%, 61%, 0.15) 0px, transparent 0%),
radial-gradient(at 97% 21%, hsla(125, 98%, 72%, 0.15) 0px, transparent 50%),
radial-gradient(at 52% 99%, hsla(354, 98%, 61%, 0.15) 0px, transparent 50%),
radial-gradient(at 10% 29%, hsla(256, 96%, 67%, 0.15) 0px, transparent 50%),
radial-gradient(at 97% 96%, hsla(38, 60%, 74%, 0.15) 0px, transparent 50%),
radial-gradient(at 33% 50%, hsla(222, 67%, 73%, 0.15) 0px, transparent 50%),
radial-gradient(at 79% 53%, hsla(343, 68%, 79%, 0.15) 0px, transparent 50%);
background-color: hsl(0 0% 100%);
font-weight: 80;
transition: background-color 0.25s, color 0.25s;
}
main {
padding: 2rem 0;
width: 100%;
}
:root:has(#theme:checked) :is(body, .controls, .item) {
background-color: hsl(0 0% 10%);
color: hsl(0 0% 100%);
border-color: hsl(0 0% 25%);
}
:root:has(#theme:checked) article {
background-color: hsl(0 0% 10%);
color: hsl(0 0% 100%);
border-color: hsl(0 0% 25%);
box-shadow: 0 10px 20px -5px hsl(0 0% 0% / 0.5);
}
:root:has(#theme:checked) .item {
background-color: black;
}
:root:has(#theme:checked) li::before {
background-color: black;
}
article {
padding: 2rem;
margin: 0 auto;
width: 100%;
box-shadow: 0 10px 20px -5px hsl(0 0% 50% / 0.5);
border: 1px solid hsl(0 0% 90%);
border-radius: 6px;
background: hsl(0 0% 100%);
resize: horizontal;
overflow: hidden;
max-width: min(calc(600px + 8rem), calc(100vw - 2rem));
min-width: 340px;
container-type: inline-size;
transition: background-color 0.25s, color 0.25s, border 0.25s, box-shadow 0.25s;
}
h2 {
display: flex;
gap: 0.25ch;
font-size: clamp(1.5rem, 4cqi + 1rem, 3rem);
font-weight: 160;
margin: 0;
grid-column: 1 / -1;
}
h2 span:last-of-type {
display: inline-block;
background: linear-gradient(to right, #9333ea, #db2777, #9333ea) 0 0 / 400% 100% no-repeat;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-animation: shade 4s infinite linear;
animation: shade 4s infinite linear;
}
@-webkit-keyframes shade {
to {
background-position: 100% 0;
}
}
@keyframes shade {
to {
background-position: 100% 0;
}
}
.header {
display: grid;
grid-template: auto 1fr / 6fr 4fr;
gap: 1rem;
margin-bottom: 2rem;
transition: opacity 0.5s;
}
article a {
align-self: start;
text-decoration: none;
justify-self: end;
border-radius: 100px;
padding: 0.5rem 2rem;
border: 0;
color: hsl(0 0% 100%);
font-weight: 120;
cursor: pointer;
background: linear-gradient(to right, #9333ea, #db2777) 0 0 / 200% 100% no-repeat;
transition: background-position 0.15s;
}
article a:is(:hover, :focus-visible) {
background-position: 100% 0;
}
p {
margin: 0;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
[for=theme] {
width: 48px;
aspect-ratio: 1;
position: fixed;
bottom: 1rem;
right: 1rem;
display: grid;
place-items: center;
}
[for=theme] svg {
width: 75%;
}
#theme + svg path:first-of-type,
#theme:checked + svg path:last-of-type {
opacity: 0;
}
#theme:checked + svg path:first-of-type {
opacity: 1;
}
.controls {
display: grid;
grid-template-columns: 1fr auto;
gap: 0.5rem;
padding: 1rem;
border: 1px solid hsl(0 0% 90%);
border-radius: 6px;
background: hsl(0 0% 100%);
position: fixed;
top: 1rem;
right: 1rem;
z-index: 2;
}
label, input {
accent-color: #db2777;
cursor: pointer;
}
/* border: 2px solid red;*/
.window {
height: 250px;
container-type: inline-size;
transform-style: preserve-3d;
width: 100%;
outline: 4px dashed transparent;
transition: outline 0.5s;
}
.scene {
--buff: 3rem;
height: 100%;
width: 100%;
-webkit-mask:
linear-gradient(transparent, white var(--buff) calc(100% - var(--buff)), transparent),
linear-gradient(90deg, transparent, white var(--buff) calc(100% - var(--buff)), transparent);
mask:
linear-gradient(transparent, white var(--buff) calc(100% - var(--buff)), transparent),
linear-gradient(90deg, transparent, white var(--buff) calc(100% - var(--buff)), transparent);
-webkit-mask-composite: source-in, xor;
mask-composite: intersect;
}
:root:has(#overflow:checked) .scene {
-webkit-mask: unset;
mask: unset;
}
:root:has(#overflow:checked) .window {
outline: 4px dashed #db2777;
}
:root:has(#overflow:checked) .header {
opacity: 0.2;
}
.dev-link {
width: 48px;
aspect-rati.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0