纯css实现三维圆柱体上下浮动效果
代码语言:html
所属分类:三维
代码描述:纯css实现三维圆柱体上下浮动效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; height: 100vh; -webkit-perspective: 600px; perspective: 600px; background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#fff3d4)); background: linear-gradient(#fff, #fff3d4); overflow: hidden; } .boxes { display: grid; width: 60vmin; height: 60vmin; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); grid-gap: 10px; -webkit-transform: translateY(-25%) rotateX(45deg) rotate(45deg); transform: translateY(-25%) rotateX(45deg) rotate(45deg); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .box { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-animation: float 3s ease-in-out infinite; animation: float 3s ease-in-out infinite; } .box:nth-child(1) { -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .box:nth-child(2) { -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .box:nth-child(3) { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .box:nth-child(4) { -webkit-animation-delay: -1.2s; animation-delay: -1.2s; } .box:nth-child(5) { -webkit-animation-delay: -1.5s; animation-delay: -1.5s; } .box:nth-child(6) { -webkit-animation-delay: -1.8s; animation-delay: -1.8s; } .box:nth-child(7) { -webkit-animation-delay: -2.1s; animation-delay: -2.1s; } .box:nth-child(8) { -webkit-animation-delay: -2.4s; animation-delay: -2.4s; } .box:nth-child(9) { -webkit-animation-delay: -2.7s; animation-delay: -2.7s; } .box:nth-child(10) { -webkit-animation-delay: -3s; animation-delay: -3s; } .box:nth-child(11) { -webkit-animation-delay: -3.3s; animation-delay: -3.3s; } .box:nth-child(12) { -webkit-animation-delay: -3.6s; animation-delay: -3.6s; } .box:nth-child(13) { -webkit-animation-delay: -3.9s; animation-delay: -3.9s; } .box:nth-child(14) { -webkit-animation-delay: -4.2s; animation-delay: -4.2s; } .box:nth-child(15) { -webkit-animation-delay: -4.5s; animation-delay: -4.5s; } .box:before, .box:after { display: block; position: absolute; content: ""; } .box:after { display: block; position: absolute; content: ""; top: 100%; left: 0; right: 0; height: 250vmin; -webkit-transform-origin: center top; transform-origin: center top; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); } .box:before { left: 100%; top: 0; bottom: 0; width: 250vmin; -webkit-transform-origin: left center; transform-origin: left center; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); } .box:nth-child(1) { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0