js+css实现2024数字翻转到2025年立体文字动画效果代码

代码语言:html

所属分类:动画

代码描述:js+css实现2024数字翻转到2025年立体文字动画效果代码

代码标签: js+css 2024 数字 翻转 2025 立体 文字 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
 
<meta charset="UTF-8">
 


<style>
html
,
body
{
 
overflow: hidden;
 
background: #000;
 
padding: 0px;
 
margin: 0px;
 
width: 100vw;
 
height: 100vh;
 
user-select: none;
}

.camera {
 
position: absolute;
 
width: 600px;
 
height: 200px;
 
left: calc(50vw - 300px);
 
top: calc(50vh - 100px);
 
transform-style: preserve-3d;
 
animation: change 10s linear infinite;
}

@keyframes change {
 
0% {
   
transform: rotateX(180deg) rotateY(-90deg);
 
}
 
10% {
   
transform: rotateX(180deg) rotateY(0deg);
 
}
 
20% {
   
transform: rotateX(180deg);
 
}
 
30% {
   
transform: rotateX(180deg);
 
}
 
40% {
   
transform: rotateX(90deg);
 
}
 
60% {
   
transform: rotateX(90deg);
 
}
 
70% {
   
transform: rotateX(180deg);
 
}
 
80% {
   
transform: rotateX(180deg);
 
}
 
90% {
   
transform: rotateX(180deg) rotateY(0deg);
 
}
 
100% {
   
transform: rotateX(180deg) rotateY(-90deg);
 
}
}

.block {
 
position: absolute;
 
left: 300px;
 
top: 100px;
 
width: 40px;
 
height: 40px;
}

.block:nth-child(6n) {
 
background: #000000;
}
.block:nth-child(6n + 1) {
 
background: #ff0000;
}
.block:nth-child(6n + 2) {
 
background: #000000;
}
.block:nth-child(6n + 3) {
 
background: #000000;
}
.block:nth-child(6n + 4) {
 
background: #ffff00;
}
.block:nth-child(6n + 5) {
 
background: #000000;
}
</style>

 
</head>

<body translate="no">
 
<div class="camera">
 
<div class="block"></div>
</div>
 
     
<script>
function ResetBlock() {
  var block_data = [];

  //2025

  //2
  block_data.push({ x: -7, y: 2, z: 0 });
  block_data.push({ x: -6, y: 2, z: 0 });
  block_data.push({ x: -5, y: 2, z: 0 });
  block_data.push({ x: -5, y: 1, z: 0 });
  block_data.push({ x: -5, y: 0, z: 0 });
  block_data.push({ x: -6, y: 0, z: 0 });
  block_data.push({ x: -7, y: 0, z: 0 });
  block_data.push({ x: -7, y: -1, z: 0 });
  block_data.push({ x: -7, y: -2, z: 0 });
  block_data.push({ x: -6, y: -2, z: 0 });
  block_data.push({ x: -5, y: -2, z: 0 });

  //0
  block_data.push({ x: -3, y: 2, z.........完整代码请登录后点击上方下载按钮下载查看

网友评论0