js+css实现弹簧式上下分页过渡动画效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现弹簧式上下分页过渡动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
font-family: sans-serif;
max-width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
--black: #151515;
--c1: #0272f2;
--c2: #ff5213;
--c3: #ffdf3f;
--c4: #01b26e;
--c5: #fea9e0;
--c6: #ffdf3f;
background: var(--black);
}
.vegetables {
perspective: 500px;
transform-style: preserve-3d;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100vw;
height: 100%;
position: absolute;
top: 0;
left: 0;
margin: 0 auto;
font-family: "Romie";
}
.vegetables * {
transform-style: preserve-3d;
}
.vegetables .inner {
position: absolute;
width: 100vw;
height: 100vh;
}
.page {
transform-style: preserve-3d;
position: absolute;
top: calc(50% - 100px);
left: 50%;
list-style: none;
padding: 0;
height: calc(90vmin - 300px);
width: 90vmin;
display: flex;
justify-content: center;
align-items: stretch;
flex-wrap: wrap;
gap: 10px;
padding: 0;
margin: 0;
transform: translate(-50%, -50%) translateZ(200vmin);
transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1) 0.75s;
}
.page li {
transition: 0.5s ease-in-out;
opacity: 0;
font-size: 7vmin;
}
.page li:nth-of-type(1) {
color: #ccc;
}
.page li:nth-of-type(1) span:after {
transform: scaleX(0);
background: #ccc;
transition: 0.5s ease-in-out 0.875s;
}
.page li:nth-of-type(2) {
color: #ccc;
}
.page li:nth-of-type(2) span:after {
transform: scaleX(0);
background: #ccc;
transition: 0.5s ease-in-out 1s;
}
.page li:nth-of-type(3) {
color: #ccc;
}
.page li:nth-of-type(3) span:after {
transform: scaleX(0);
background: #ccc;
transition: 0.5s ease-in-out 1.125s;
}
.page li:nth-of-type(4) {
color: #ccc;
}
.page li:nth-of-type(4) span:after {
transform: scaleX(0);
background: #ccc;
transition: 0.5s ease-in-out 1.25s;
}
.page li:nth-of-type(5) {
color: #ccc;
}
.page li:nth-of-type(5) span:after {
transform: scaleX(0);
background: #ccc;
transition: 0.5s ease-in-out 1.375s;
}
.page.current {
transform: translate(-50%, -50%) translateZ(0vmin);
}
.page.current li {
opacity: 1;
background-position: 50% 100%;
}
.page.current li:nth-of-type(1) {
transition: 0.5s ease-in-out 0.75s, color 0.5s ease-in-out 1.125s;
color: var(--c1);
}
.page.current li:nth-of-type(1) span:after {
transform: scaleX(1);
background: var(--c1);
transition: 0.5s ease-in-out 0.875s;
}
.page.current li:nth-of-type(2) {
transition: 0.5s ease-in-out 0.75s, color 0.5s ease-in-out 1.25s;
color: var(--c2);
}
.page.current li:nth-of-type(2) span:after {
transform: scaleX(1);
background: var(--c2);
transition: 0.5s ease-in-out 1s;
}
.page.current li:nth-of-type(3) {
transition: 0.5s ease-in-out 0.75s, color 0.5s ease-in-out 1.375s;
color: var(--c3);
}
.page.current li:nth-of-type(3) span:after {
transform: scaleX(1);
background: var(--c3);
transition: 0.5s ease-in-out 1.125s;
}
.page.current li:nth-of-type(4) {
transition: 0.5s ease-in-out 0.75s, color 0.5s ease-in-out 1.5s;
color: var(--c4);
}
.page.current li:nth-of-type(4) span:after {
transform: scaleX(1);
background: var(--c4);
transition: 0.5s ease-in-out 1.25s;
}
.page.current li:nth-of-type(5) {
transition: 0.5s ease-in-out 0.75s, color 0.5s ease-in-out 1.625s;
color: var(--c5);
}
.page.current li:nth-of-type(5) span:after {
transform: scaleX(1);
background: var(--c5);
transition: 0.5s ease-in-out 1.375s;
}
.page.current:nth-of-type(even) li:nth-of-type(1) {
color: var(--c5);
}
.page.current:nth-of-type(even) li:nth-of-type(1) span:after {
background: var(--c5);
}
.page.current:nth-of-type(even) li:nth-of-type(2) {
color: var(--c4);
}
.page.current:nth-of-type(even) li:nth-of-type(2) span:after {
background: var(--c4);
}
.page.current:nth-of-type(even) li:nth-of-type(3) {
color: var(--c3);
}
.page.current:nth-of-type(even) li:nth-of-type(3) span:after {
background: var(--c3);
}
.page.current:nth-of-type(even) li:nth-of-type(4) {
color: var(--c2);
}
.page.current:nth-of-type(even) li:nth-of-type(4) span:after {
background: var(--c2);
}
.page.current:nth-of-type(even) li:nth-of-type(5) {
color: var(--c1);
}
.page.current:nth-of-type(even) li:nth-of-type(5) span:after {
background: var(--c1);
}
.page li {
display: flex;
justify-content: flex-start;
align-items: center;
width: 100%;
overflow: hidden;
}
.page li span {
display: inline-block;
position: relative;
background: var(--black);
}
.page li span:after {
content: "";
position: absolute;
width: 100vw;
left: calc(100% + 1rem);
top: calc(50% - 0.5px);
height: 1px;
background: .........完整代码请登录后点击上方下载按钮下载查看
















网友评论0