div+css实现三维立体多边形旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现三维立体多边形旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> html, body { height: 100%; } body { overflow: hidden; margin: 0; perspective: 32em; background: dimgrey; color: white; } .polyhedron, .polyhedron *, .polyhedron *:before { box-sizing: border-box; position: absolute; top: 50%; left: 50%; transform-style: preserve-3d; } .polyhedron { animation: ani 39s linear infinite; } @keyframes ani { to { transform: rotate(360deg) rotateX(-720deg) rotateY(1080deg); } } .polyhedron--prism--triangular { transform: translateY(8em); } .polyhedron--prism--triangular .polyhedron--prism--triangular__face { transform: translateY(8em) rotateX(-90deg) rotate(60deg) translateY(4.6188em); } .polyhedron--prism--triangular .polyhedron--prism--triangular__face .polygon:before { background: rgba(255, 255, 255, 0.32); } .polyhedron__face:nth-child(1) .polygon:before { background: linear-gradient(90deg, rgba(255, 0, 0, 0.32), rgba(0, 255, 0, 0.32)); } .polyhedron--tetrahedron__face:nth-child(1) { transform: rotateY(0deg) translateZ(4.6188em) rotateX(19.47122deg); } .polyhedron--prism--triangular__face:nth-child(1) { transform: rotateY(0deg) translateZ(4.6188em); } .polyhedron__face:nth-child(2) .polygon:before { background: linear-gradient(90deg, rgba(0, 255, 0, 0.32), rgba(0, 0, 255, 0.32)); } .polyhedron--tetrahedron__face:nth-child(2) { transform: rotateY(120deg) translateZ(4.6188em) rotateX(19.47122deg); } .polyhedron--prism--triangular__face:nth-child(2) { transform: rotateY(120deg) translateZ(4.6188em); } .polyhedron__face:nth-child(3) .polygon:before { background: linear-gradient(90deg, rgba(0, 0, 255, 0.32), rgba(255, 0, 0, 0.32)); } .polyhedron--tetrahedron__face:nth-child(3) { transform: rotateY(240deg) translateZ(4.6188em) rotateX(19.47122deg); } .polyhedron--prism--triangular__face:nth-child(3) { transform: rotateY(240deg) translateZ(4.6188em); } .polygon { borde.........完整代码请登录后点击上方下载按钮下载查看
网友评论0