div+css实现公鸡行走动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现公鸡行走动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> *, *::after, *::before { padding: 0; margin: 0; box-sizing: border-box; } :root { --color-bg: #f0693e; --color-1: #f3c074; --color-2: #753d22; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: var(--color-bg); overflow: hidden; } .rooster { position: relative; animation: body-ans 0.6s linear infinite; } .rooster__head { width: 3rem; height: 3rem; background-color: var(--color-2); margin-left: 1.5rem; --radius: 10rem; border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); } .rooster__head--wing { --h: 1.6rem; --w: calc(var(--h) * 2); position: absolute; top: calc(var(--h) * -0.9); left: 1rem; width: var(--w); height: var(--h); border-radius: 0 0 4rem 4rem; border-left: 0.8rem solid #c71e24; background-color: #d52026; animation: ans-wing-1 0.4s infinite; } @keyframes ans-wing-1 { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(10deg); } } .rooster__head--wing--2 { --h: 2.8rem; --w: calc(var(--h) / 2); position: absolute; top: calc(var(--h) * -1); left: 2.8rem; width: var(--w); height: var(--h); border-radius: 0 4rem 4rem 0; background-color: #a21f21; border-right: 4px solid #991c1e; transform-origin: bottom; transform: rotate(-10deg); animation: ans-wing-2 0.4s ease-in-out infinite; } @keyframes ans-wing-2 { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(-20deg); } } .rooster__head--wing--3 { --h: 1.2rem; --w: calc(var(--h) * 2); position: absolute; top: -0.4rem; left: 2.6rem; width: var(--w); height: var(--h); border-radius: 0 0 4rem 4rem; background-color: #a21f21; border-right: 4px solid #991c1e; transform-origin: bottom; --rotate: 15deg; transform: rotate(var(--rotate)); animation: ans-wing-3 0.5s infinite; } .rooster__head--wing--4 { --h: 2.8rem; --w: calc(var(--h) / 2); position: absolute; top: calc(var(--h) * -0.9); left: 2.4rem; width: var(--w); height: var(--h); border-radius: 4rem 0 2rem 0; background-color: #d52026; border-right: 8px solid #c71e24; transform-origin: bottom; --rotate: 10deg; transfor.........完整代码请登录后点击上方下载按钮下载查看
网友评论0