svg+css实现可爱熊猫动画效果代码
代码语言:html
所属分类:动画
代码描述:svg+css实现可爱熊猫动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { background-color: #dfe; background-image: repeating-linear-gradient(20deg, #0000, #0000 20px, #2431 50px), repeating-linear-gradient(110deg, #0000, #0000 20px, #2431 50px) } svg { width: 100vw; height: 100vh; } .line { fill: none; stroke: #222; stroke-width: 5px; } .ear { fill: #111; animation: head 1s -0.2s infinite alternate ease-in-out } .ear__g { fill: #444; animation: head 1s -0.1s infinite alternate ease-in-out } .head { fill: #eee; stroke: #111; stroke-width: 5px; animation: head 1s infinite alternate ease-in-out } .eye { fill: #111; animation: head 1s -0.1s infinite alternate ease-in-out } .eye__w { fill: #fff; animation: head 1s infinite alternate ease-in-out } .eye__i { fill: #111; animation: head 1s 0.1s infinite alternate ease-in-out } .nose__1 { fill: #111; animation: head 1s 0.1s infinite alternate ease-in-out } .nose__2 { fill: none; stroke: #111; stroke-width: 5px; animation: head 1s 0.1s infinite alternate ease-in-out } @keyframes head { from { transform: translateY(-20px); } to { transform: translateY(20px); } } .eyes { animation: eyes 5.5s infinite ease-in-out } @keyframes eyes { 0%, 35% { transform: translateX(0); } 15%, 25% { transform: translateX(5px); } 10%, 20% { transform: translateX(-5px); } } .nose { transform-origin: 500px 650px; animation: nose 5.5s infinite ease-in-out } @keyframes nose { 0%, 35% { transform: rotate(0deg); } 15%, 25% { transform: rotate(5deg); } 10%, 20% { transform: rotate(-5deg); } } .body__b { fill: #111; stroke: #111; stroke-width: 5px; animation: body 1s -0.25s infinite alternate ease-in-out } .body__w { fill: #eee; stroke: #111; stroke-width: 5px; animation: body 1s -0.5s infinite alternate ease-in-out } @keyframes body { from { transform: translateY(-5px); } to { transform: translateY(5px); } } .paws__b { fill: #111 } .paws__p { fill: #444 } .paw__l { transform-origin: 200px 1800px; animation: paw 8s infinite ease-in-out } .paw__r { transform-origin: 800px 1800px; animation: paw 8s infinite ease-in-out } @keyframes paw { 0%, 20%, 100% { transform: rotate(4deg); } 10% { transform: rotate(2deg); } 50%, 70% { transform: rotate(-4deg); } 60% { transform: rotate(-2deg); } } </style> </head> <body> <!-- partial:index.partial.html --> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="-500 0 2000 2000"> <path class="body__b" d="M -50 1250 c 0 200 -200 200 -200 0c 0 -750 1500 -750 1500 0 c 0 200 -200 200 -200 0" /> <path class="body__w" d="M 0 1000 c -500 1000 1500 1000 1000 0 c 0 100 -1000 100 -1000 0" /> <path class="ear" d="M 200 320 c -150 -300 200 -300 200 -150 q -150 50 -200 150 z" /&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0