css小狗摆动尾巴陪你玩球动画效果代码
代码语言:html
所属分类:动画
代码描述:css小狗摆动尾巴陪你玩球动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --value: 1; } input { margin: 1rem 0; } .ball { width: 32px; height: 32px; border-radius: 50%; margin-top: 4rem; z-index: 0; } .ball:after { content: ""; position: absolute; display: block; top: 0; left: 0; height: 100%; width: 100%; border-radius: 50%; box-shadow: inset 0 -8px 0 0 rgba(0, 0, 0, 0.2); background: var(--ball, red); z-index: 1; } .ball:focus { outline: none; } .ball:focus:after { -webkit-animation: bounce calc(var(--value) * 400ms) infinite alternate; animation: bounce calc(var(--value) * 400ms) infinite alternate; } @-webkit-keyframes bounce { from { transform: scale(2); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { transform: scale(0.8); -webkit-animation-timing-function: cubic-bezier(0, 0, 0, 1); animation-timing-function: cubic-bezier(0, 0, 0, 1); } } @keyframes bounce { from { transform: scale(2); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { transform: scale(0.8); -webkit-animation-timing-function: cubic-bezier(0, 0, 0, 1); animation-timing-function: cubic-bezier(0, 0, 0, 1); } } @-webkit-keyframes bounce-shadow { from { transform: scale(2.5, 2.6) translateY(-50%); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { transform: scale(0.5) translateY(0); -webkit-animation-timing-function: cubic-bezier(0, 0, 0, 1); animation-timing-function: cubic-bezier(0, 0, 0, 1); } } @keyframes bounce-shadow { from { transform: scale(2.5, 2.6) translateY(-50%); -webkit-animation-timing-function: ease-in; animation-timing-function: ease-in; } to { transform: scale(0.5) translateY(0); -webkit-animation-timing-function: cubic-bezier(0, 0, 0, 1); animation-timing-function: cubic-bezier(0, 0, 0, 1); } } .ball:focus:before { content: ""; position: absolute; display: block; top: 0; left: 0; width: 100%; height: 100%; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0