js+css实现键盘立体可视化数字滚动页面翻转动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:js+css实现键盘立体可视化数字滚动页面翻转动画效果代码
代码标签: js css 键盘 立体 可视化 数字 滚动 页面 翻转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@property --rotate-x {
syntax: "<angle>";
inherits: true;
initial-value: 0deg;
}
@property --scene-rotation {
syntax: "<angle>";
inherits: true;
initial-value: 0deg;
}
@property --key-color {
syntax: "<color>";
inherits: true;
initial-value: transparent;
}
@property --foo {
syntax: "<number>";
inherits: true;
initial-value: 0;
}
:root {
--color-primary: #5c4293;
--color-secondary: #dd6058;
--color-tertiary: #cfa469;
--color-quaternary: #27235a;
--color-surface: black;
--key-depth: 4rem;
--key-width: 4rem;
--key-height: 5rem;
--key-height-delta: 0rem;
--key-color: rgba(255, 255, 255, 0.6);
}
body {
color: var(--color-primary);
background: url("//repo.bfw.wiki/bfwrepo/image/6701d58fdb581.png") center center no-repeat, #1f1f20;
background-size: cover;
background-attachment: fixed;
margin: 0;
font-family: "Road Rage", "Helvetica Neue", Roboto, "sans-serif";
}
body:after {
height: 100dvh;
content: "";
position: fixed;
background: url(//repo.bfw.wiki/bfwrepo/icon/5de90f964d501.png);
mix-blend-mode: overlay;
inset: 0;
opacity: 0.5;
pointer-events: none;
filter: invert(1);
z-index: 0;
}
a.labs-follow-me {
left: 2rem;
right: 2rem;
bottom: 1rem;
top: unset;
text-align: center;
}
@-webkit-keyframes rotate360 {
from {
transform: rotate3d(1, 1, 1, 0deg);
}
to {
transform: rotate3d(1, 1, 1, 360deg);
}
}
@keyframes rotate360 {
from {
transform: rotate3d(1, 1, 1, 0deg);
}
to {
transform: rotate3d(1, 1, 1, 360deg);
}
}
@-webkit-keyframes scene-rotation {
from {
--scene-rotation: -5deg;
}
50% {
--scene-rotation: 12deg;
}
to {
--scene-rotation: -5deg;
}
}
@keyframes scene-rotation {
from {
--scene-rotation: -5deg;
}
50% {
--scene-rotation: 12deg;
}
to {
--scene-rotation: -5deg;
}
}
.scene {
transform-style: preserve-3d;
position: absolute;
transition: transform 0.1s linear;
transform: rotateX(calc(21deg - var(--rotate-x, 0deg))) rotateY(var(--scene-rotation));
}
:root {
-ms-scroll-snap-type: y mandatory;
scroll-snap-type: y mandatory;
}
.views .item {
font-size: 14rem;
display: grid;
place-items: center;
scroll-snap-align: center;
height: 100dvh;
width: 100dvw;
text-shadow: 0 0 1rem #d4bee8;
color: white;
-webkit-animation: show linear both;
animation: show linear both;
animation-timeline: --bubu;
animation-range: entry-crossing 0% exit-crossing 100%;
view-timeline: --bubu block;
}
.layers {
position: fixed;
z-index: 2;
top: 50dvh;
font-size: 25dvh;
left: 0;
right: 0;
text-align: center;
-webkit-animation: slide-up 0.01s linear;
animation: slide-up 0.01s linear;
animation-timeline: scroll(root block);
--num-children: 6;
--size-per-child: calc(100% / var(--num-children));
--half-size-per-child: calc(var(--size-per-child) / 2);
--start-pos: calc(var(--half-size-per-child) * -1);
--end-pos: calc(-100% + var(--half-size-per-child));
translate: 0 var(--start-pos);
}
.layers .item {
height: 2rem;
color: white;
display: grid;
place-items: center;
transform-style: preserve-3d;
transition: transform 0.6s linear;
transform: translate3d(0, 30dvh, -400rem) perspective(27rem) scale(0.2);
--foo: 0.8;
--rotate-x: -50deg;
}
.layers .item.before {
transform: translate3d(0, -30dvh, -400rem) perspective(27rem) scale(0.2);
--rotate-x: -50deg;
}
.layers .item.active {
--foo: 0;
transform: translate3d(0, 0, 0rem) perspective(27rem) scale(1);
--rotate-x: -1deg;
}
.layers .item.active .scene {
-webkit-animation: 10s ease-in-out scene-rotation infinite;
animation: 10s ease-in-out scene-rotation infinite;
}
@property --key-height-delta {
syntax: "<length>";
initial-value: 0;
inherits: true;
}
.container {
width: var(--width);
height: var(--width);
transform-style: preserve-3d;
position: relative;
transform: rotate3d(1, 0, 0, -90deg);
}
.container .face {
transform-style: preserve-3d;
position: absolute;
display: grid;
place-items: center;
font-size: 0.75rem;
background: radial-gradient(circle at 50% -40%, var(--key-color), transparent 80%);
border-radius: 0 0 var(--key-radius) var(--key-radius);
opacity: 0.5;
}
.container .face.front {
width: .........完整代码请登录后点击上方下载按钮下载查看
















网友评论0