css彩灯闪烁圣诞树下的小猫咪效果代码
代码语言:html
所属分类:动画
代码描述:css彩灯闪烁圣诞树下的小猫咪效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --light-nutcracker-a: #fdf8d1; --light-nutcracker-b: rgb(253, 177, 177); --light-classic-a: rgb(163, 255, 160); --light-classic-b: rgb(255, 196, 206); --light-gold-a: rgb(255, 228, 160); --light-gold-b: rgb(249, 240, 211); --light-blue-a: rgb(139, 223, 245); --light-blue-b: rgb(215, 245, 255); --height: 1rem; } html, body { width: 100%; height: 100vh; background-color: #ffdae0; font-family: sans-serif; } *:not(.settings) { position: absolute; } *:not(.settings):before, *:not(.settings):after { content: ""; position: absolute; } .radio[value="nutcracker"]:checked ~ * { --light: var(--light-nutcracker-a); --light-secondary: var(--light-nutcracker-b); } .radio[value="classic"]:checked ~ * { --light: var(--light-classic-a); --light-secondary: var(--light-classic-b); } .radio[value="gold"]:checked ~ * { --light: var(--light-gold-a); --light-secondary: var(--light-gold-b); } .radio[value="blue"]:checked ~ * { --light: var(--light-blue-a); --light-secondary: var(--light-blue-b); } .container { width: 450px; height: 450px; transform: translate(-50%, -50%); left: 58%; top: 50%; } .snow-base { bottom: -5px; width: 300px; height: 100px; background-color: #fefefe; z-index: -1; border-radius: 100%; } .snow-base:before { z-index: -2; width: 200px; height: 80px; background-color: #fefefe; border-radius: 100%; left: -40px; top: 40%; } .snow-base:after { z-index: -2; width: 200px; height: 80px; background-color: #fefefe; border-radius: 100%; left: 100px; top: 40%; } .tree { width: 200px; height: 250px; left: 40%; top: 12%; transform-origin: center; transform: rotate(20deg); animation: rotateTree 3s alternate infinite; z-index: 2; } .tree .star { z-index: 9; margin: 50px 0; display: block; color: #fffbe6; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid #fffbe6; border-left: 100px solid transparent; transform: rotate(40deg) scale(0.3); left: -33%; top: -25%; transform-origin: center; animation: rotateStar 3s infinite; } .tree .star:before { border-bottom: 80px solid #fffbe6; border-left: 30px solid transparent; border-right: 30px solid transparent; height: 0; width: 0; top: -45px; left: -65px; display: block; transform: rotate(-35deg); } .tree .star:after { display: block; color: #fffbe6; top: 3px; left: -105px; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid #fffbe6; border-left: 100px solid transparent; transform: rotate(-70deg); } .tree .tree-layer { position: relative; width: 100%; height: auto; display: flex; transform: translateX(-50%); left: 50%; } .tree .tree-layer .leaf { position: relative; width: 55px; height: 120px; background-color: #58b1a1; border-radius: 200px; margin: 0 -9%; } .tree .tree-layer .leaf:nth-child(1) { transform: rotate(50deg) scale(0.6); box-shadow: inset 0px -10px #449284; } .tree .tree-layer .leaf:nth-child(2) { transform: rotate(5deg) scale(0.6); box-shadow: inset 0px -10px #449284; } .tree .tree-layer .leaf:nth-child(3) { transform: rotate(-40deg) scale(0.6); box-shadow: inset 0px -10px #449284; } .tree .tree-layer .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(3) { z-index: 8; } .tree .tree-layer:nth-child(4) { top: -43%; z-index: 7; } .tree .tree-layer:nth-child(4) > .leaf { background-color: #fefefe; } .tree .tree-layer:nth-child(4) > .leaf:nth-child(1) { transform: rotate(50deg) scale(0.6); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(4) > .leaf:nth-child(2) { transform: rotate(5deg) scale(0.6); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(4) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(0.6); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(4) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(5) { z-index: 6; top: -78%; } .tree .tree-layer:nth-child(5) > .leaf { background-color: #58b1a1; } .tree .tree-layer:nth-child(5) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(5) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(5) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(1); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(5) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(6) { top: -120%; z-index: 5; } .tree .tree-layer:nth-child(6) > .leaf { background-color: #fefefe; } .tree .tree-layer:nth-child(6) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(6) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(6) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(1); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(6) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(7) { top: -150%; z-index: 4; } .tree .tree-layer:nth-child(7) > .leaf { background-color: #58b1a1; } .tree .tree-layer:nth-child(7) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1.4); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(7) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1.4); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(7) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(1.4); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(7) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(8) { top: -190%; z-index: 3; } .tree .tree-layer:nth-child(8) > .leaf { background-color: #fefefe; } .tree .tree-layer:nth-child(8) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1.4); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(8) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1.4); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(8) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(1.4); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(8) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(9) { top: -220%; z-index: 2; } .tree .tree-layer:nth-child(9) > .leaf { background-color: #58b1a1; } .tree .tree-layer:nth-child(9) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1.8); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(9) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1.8); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(9) > .leaf:nth-child(3) { transform: rotate(-40deg) scale(1.8); box-shadow: inset 0px -10px #449284; } .tree .tree-layer:nth-child(9) > .leaf:nth-child(2) { z-index: 2; } .tree .tree-layer:nth-child(10) { top: -260%; z-index: 1; } .tree .tree-layer:nth-child(10) > .leaf { background-color: #fefefe; } .tree .tree-layer:nth-child(10) > .leaf:nth-child(1) { transform: rotate(50deg) scale(1.8); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-layer:nth-child(10) > .leaf:nth-child(2) { transform: rotate(5deg) scale(1.8); box-shadow: inset 0px -5px #e5e5e5; } .tree .tree-l.........完整代码请登录后点击上方下载按钮下载查看
网友评论0