css实现3d打印机出错三维动画效果代码
代码语言:html
所属分类:三维
代码描述:css实现3d打印机出错三维动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
:root {
--dark-color-h: 334.29;
--dark-color-s: 32.03%;
--dark-color-l: 30%;
--light-color-h: 19.2;
--light-color-s: 30.86%;
--light-color-l: 84.12%;
--dark-color: hsl(
var(--dark-color-h),
var(--dark-color-s),
var(--dark-color-l)
);
--light-color: hsl(
var(--light-color-h),
var(--light-color-s),
var(--light-color-l)
);
--bg-color: var(--dark-color);
--text-color: var(--light-color);
--resources-bg-color: hsla(
var(--dark-color-h),
var(--dark-color-s),
calc(var(--dark-color-l) - 10%),
0.75
);
--resources-active-color: color-mix(
in srgb,
var(--light-color) 75%,
transparent
);
--resources-color: var(--text-color);
}
*,
::after,
::before {
border-style: solid;
border-width: 0;
box-sizing: border-box;
}
* {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
align-items: center;
background: var(--bg-color);
color: var(--text-color);
display: grid;
font-family: "Roboto", sans-serif;
justify-items: center;
margin: 0;
min-height: 100vh;
overflow: hidden;
place-items: center;
width: 100%;
}
.scene {
perspective: 300px;
transform-style: preserve-3d;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
width: 100%;
}
.cube,
.scene {
align-items: center;
display: grid;
justify-items: center;
place-items: center;
pointer-events: none;
position: relative;
}
.cube {
animation: rotate-cube 5s linear infinite;
backface-visibility: hidden;
height: 6.25rem;
transform: translateZ(0);
transform-origin: center;
transform-style: preserve-3d;
width: 6.25rem;
will-change: transform;
}
.cube,
.slice {
grid-area: 1/-1;
}
.slice {
background: linear-gradient(180deg, var(--dark-color), var(--light-color));
border: thin solid
hsla(
var(--dark-color-h),
var(--dark-color-s),
calc(var(--dark-color-l) - 5%),
0.35
);
border-radius: 1rem;
height: 100%;
opacity: 0.5;
pointer-events: none;
position: relative;
transform-origin: center;
transform-style: preserve-3d;
width: 100%;
transform: translateX(var(--shift)) translateY(var(--shift))
translateZ(calc(var(--i) * 3px)) scale(2);
}
@keyframes rotate-cube {
0% {
transform: rotateX(104deg) rotateY(0deg) rotateZ(0deg);
}
5% {
transform: rotateX(102deg) rotateY(0deg) rotateZ(18deg);
}
10% {
transform: rotateX(98deg) rotateY(0deg) rotateZ(36deg);
}
15% {
transform: rotateX(95deg) rotateY(0deg) rotateZ(54deg);
}
20% {
transform: rotateX(92deg) rotateY(0deg) rotateZ(72deg);
}
25% {
transform: rotateX(90deg) rotateY(0deg) rotateZ(90deg);
}
30% {
transform: rotateX(87deg) rotateY(0deg) rotateZ(108deg);
}
35% {
transform: rotateX(85deg) rotateY(0deg) rotateZ(126deg);
}
40% {
transform: rotateX(83deg) rotateY(0deg) rotateZ(144deg);
}
45% {
transform: rotateX(81deg) rotateY(0deg) rotateZ(162deg);
}
50% {
transform: rotateX(80deg) rotateY(0deg) rotateZ(180deg);
}
55% {
transform: rotateX(81deg) rotateY(0deg) rotateZ(198deg);
}
60% {
transform: rotateX(83deg) rotateY(0deg) rotateZ(216deg);
}
65% {
transform: rotateX(85deg) rotateY(0deg) rotateZ(234deg);
}
70% {
transform: rotateX(87deg) rotateY(0deg) rotateZ(252deg);
}
75% {
transform: rotateX(90deg) rotateY(0deg) rotateZ(270deg);
}
80% {
transform: rotateX(92deg) rotateY(0deg) rotateZ(288deg);
}
85% {
transform: rotateX(95deg) rotateY(0deg) rotateZ(306deg);
}
90% {
transform: rotateX(98deg) rotateY(0deg) rotateZ(324deg);
}
95% {
transform: rotateX(102deg) rotateY(0deg) rotateZ(342deg);
}
100% {
transform: rotateX(104deg) rotateY(0deg) rotateZ(360.5deg); /* Fix for Safari iframe bug */
}
}
.resources-layer {
bottom: 0;
display: block;
position: fixed;
right: 0;
z-index: 1000;
transform: translateZ(1100px);
transform-style: preserve-3d;
}
.resources {
background: var(--resources-bg-color);
display: grid;
font-size: 0.6875rem;
font-weight: 300;
grid-auto-flow: column;
line-height: 1.3;
padding: 0.5rem;
pointer-events: auto;
}
.resources a {
align-content: center;
display: grid;
justify-content: center;
padding: 0 0.5rem;
place-content: center;
transition: color 0.2s ease-in-out;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0