div+css实现线框立体方块旋转动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现线框立体方块旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @property --hue { syntax: "<angle>"; initial-value: 0deg; inherits: false; } div { transform-style: preserve-3d; box-sizing: border-box; } .cont { --clr: hsl(var(--hue) 80% 80%); --hue2: calc(var(--hue) + 90deg); --clr2: hsl(var(--hue2) 80% 80%); color: var(--clr); filter: drop-shadow(0 0 1.5vmin currentcolor); animation: clr-chg infinite 10s linear; display: visible; } .cube { width: 40vmin; aspect-ratio: 1; position: relative; rotate: 1 1 1 45deg; animation: rot infinite 20s linear; } .cube:hover { animation-play-state: paused; } .cube:hover .side { --clr2: color-mix(in lab, var(--clr), #fff); box-shadow: 0 0 2vmin currentcolor; } .side { --ang: 45deg; position: absolute; inset: 0; font-size: 3rem; background-image: repeating-linear-gradient(var(--ang), #0000 0 9%, var(--clr) 0 14%, #0000 0 23%, var(--clr2) 0 27%, #0000 0); } .side:nth-of-type(1) { translate: 0 0 20vmin; } .side:nth-of-type(2) { rotate: y 90deg; translate: 20vmin; transform: rotatez(270deg); } .side:nth-of-type(3) { rotate: y 90deg; translate: -20vmin; transform: rotatez(90deg); } .side:nt.........完整代码请登录后点击上方下载按钮下载查看
网友评论0