css实现一个三维彩色壁画方块旋转穿梭动画效果代码
代码语言:html
所属分类:三维
代码描述:css实现一个三维彩色壁画方块旋转穿梭动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> *, *::after, *::before { margin: 0; padding: 0; border: 0; box-sizing: border-box; } body { display: grid; height: 100vh; width: 100vw; overflow: hidden; background: #000; perspective: 50vmin; transform-style: preserve-3d; -webkit-animation: perspective 30s ease-in-out infinite; animation: perspective 30s ease-in-out infinite; } .scene { place-self: center; transform-style: preserve-3d; transform: translatez(50vmin); -webkit-animation: translate 30s ease-in-out infinite; animation: translate 30s ease-in-out infinite; } .cube { display: grid; transform-style: preserve-3d; -webkit-animation: rotation 30s linear infinite; animation: rotation 30s linear infinite; } .cube > * { place-self: center; position: absolute; } .cube > *:nth-of-type(1) { transform: translateZ(24.95vmin); } .cube > *:nth-of-type(2) { transform: rotateY(180deg) translateZ(24.95vmin); } .cube > *:nth-of-type(3) { transform: rotateY(90deg) translateZ(24.95vmin); } .cube > *:nth-of-type(4) { transform: rotateY(-90deg) translateZ(24.95vmin); } .cube > *:nth-of-type(5) { transform: rotateX(90deg) translateZ(24.95vmin); } .cube > *:nth-of-type(6) { transform: rotateX(-90deg) translateZ(24.95vmin); } .wall { display: grid; grid-gap: 3.8461538462vmin; grid-template-rows: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr); height: 50vmin; width: 50vmin; padding: 3.8461538462vmin; border: 0.25vmin solid #000; background: #000; } .wall::before { content: ""; height: 100%; width: 100%; position: absolute; opacity: 0.2; background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/32/010.Pattern.090.Image.noise.filtered.jpg); } .wall:nth-child(1) > *:nth-of-type(1) { background: linear-gradient(-45deg, #eef257 0% 14.2857142857%, #d4dfa0 14.2857142857% 28.5714285714%, #3daa7f 28.5714285714% 42.8571428571%, #df650f 42.8571428571% 57.1428571429%, #342978 57.1428571429% 71.4285714286%, #5f9df0 71.4285714286% 85.7142857143%, #eb796f 85.7142857143% 100%); } .wall:nth-child(1) > *:nth-of-type(2) { background: linear-gradient(-45deg, #c403be 0% 14.2857142857%, #ccc126 14.2857142857% 28.5714285714%, #bb63e4 28.5714285714% 42.8571428571%, #d4257e 42.8571428571% 57.1428571429%, #839c73 57.1428571429% 71.4285714286%, #699e58 71.4285714286% 85.7142857143%, #916479 85.7142857143% 100%); } .wall:nth-child(1) > *:nth-of-type(3) { background: linear-gradient(90deg, #7ee4b4 0% 20%, #d4aa19 20% 40%, #a43c59 40% 60%, #cdba5e 60% 80%, #9d827f 80% 100%); } .wall:nth-child(1) > *:nth-of-type(4) { background: linear-gradient(90deg, #5bab94 0% 20%, #a2f77b 20% 40%, #1a9bd9 40% 60%, #ae4158 60% 80%, #d4914d 80% 100%); } .wall:nth-child(2) > *:nth-of-type(1) { background: linear-gradient(90deg, #bb2a2f 0% 20%, #4194e0 20% 40%, #97fc25 40% 60%, #f09f48 60% 80%, #2752d0 80% 100%); } .wall:nth-child(2) > *:nth-of-type(2) { background: linear-gradient(0deg, #41f2e4 0% 20%, #a8e722 20% 40%, #21dd22 40% 60%, #7cd3c4 60% 80%, #0e66e0 80% 100%); } .wall:nth-child(2) > *:nth-of-type(3) { background: linear-gradient(45deg, #e8c0b1 0% 14.2857142857%, #26b791 14.2857142857% 28.5714285714%, #6d4ef0 28.5714285714% 42.8571428571%, #dbfa22 42.8571428571% 57.1428571429%, #4b25a4 57.1428571429% 71.4285714286%, #a70929 71.4285714286% 85.7142857143%, #11a986 85.7142857143% 100%); } .wall:nth-child(2) > *:nth-of-type(4) { background: linear-gradient(-45deg, #447ae7 0% 14.2857142857%, #c12aa0 14.2857142857% 28.5714285714%, #6220be 28.5714285714% 42.8571428571%, #0096b4 42.8571428571% 57.1428571429%, #b9a3d8 57.1428571429% 71.4285714286%, #e00869 71.4285714286% 85.7142857143%, #336b22 85.7142857143% 100%); } .wall:nth-child(3) > *:nth-of-type(1) { background: linear-gradient(90deg, #9f93ee 0% 20%, #d65e40 20% 40%, #0158e1 40% 60%, #64e7df 60% 80%, #7632a6 80% 100%); } .wall:nth-child(3) > *:nth-of-type(2) { background: linear-gradient(-45deg, #f3cc4b 0% 14.2857142857%, #dd991a 14.2857142857% 28.5714285714%, #13cb78 28.5714285714% 42.8571428571%, #31a9cf 42.8571428571% 57.1428571429%, #44a7e8 57.1428571429% 71.4285714286%, #02fb5d 71.4285714286% 85.7142857143%, #2309c2 85.7142857143% 100%); } .wall:nth-child(3) > *:nth-of-type(3) { background: linear-gradient(-45deg, #0f6089 0% 14.2857142857%, #35a427 14.2857142857% 28.5714285714%, #1601c2 28.5714285714% 42.8571428571%, #79e5e0 42.8571428571% 57.1428571429%, #da94e4 57.1428571429% 71.4285714286%, #958a3d 71.4285714286% 85.7142857143%, #c89d62 85.7142857143% 100%); } .wall:nth-child(3) > *:nth-of-type(4) { background: linear-gradient(45deg, #f67435 0% 14.2857142857%, #ada782 14.2857142857% 28.5714285714%, #057f0c 28.5714285714% 42.8571428571%, #00eba7 42.8571428571% 57.1428571429%, #c1341e 57.1428571429% 71.4285714286%, #21ed24 71.4285714286% 85.7142857143%, #5eb6cf 85.7142857143% 100%); } .wall:nth-child(4) > *:nth-of-type(1) { background: linear-gradient(45deg, #37e25c 0% 14.2857142857%, #cc4329 14.28571.........完整代码请登录后点击上方下载按钮下载查看
网友评论0