div+css实现荡秋千的小女孩动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现荡秋千的小女孩动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .wrapper { position: absolute; top: 50%; left: 50%; width: 200px; height: 200px; transform: translate(-50%, -50%) scale(1.2); } .wrapper .pole { position: absolute; width: 5px; height: 250px; left: 50%; transform-origin: center top; transform: translateX(-50%) rotate(-25deg); color: silver; background: currentColor; } .wrapper .pole.two { transform: translateX(-50%) rotateY(-180deg) rotate(-25deg); } .wrapper .pole:before { content: ""; position: absolute; top: -10px; left: -7px; width: 20px; height: 20px; border-radius: 100%; background: currentColor; } .wrapper .pole:after { content: ""; position: absolute; left: 0; bottom: 0; width: 20px; height: 5px; transform: translateX(-50%) rotate(25deg); background: currentColor; } .wrapper .swing { position: absolute; width: 40px; height: 100%; left: calc(50% - 20px); transform-origin: center top; -webkit-animation-duration: 0.8s; animation-duration: 0.8s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; -webkit-animation-direction: alternate; animation-direction: alternate; } .wrapper .swing .human { position: absolute; width: 40px; height: 80px; bottom: 5px; z-index: -1; } .wrapper .swing .human .top-part { position: absolute; width: 40px; height: 80px; bottom: 5px; transform-origin: center bottom; -webkit-animation-name: body-animation; animation-name: body-animation; -webkit-animation-duration: 0.8s; animation-duration: 0.8s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: ease-in-out; animation-timing-function: ease-in-out; -webkit-animation-direction: alternate; animation-direction: alternate; } .wrapper .swing .human .top-part .head { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; background: #d59e7b; border-radius: 100%; z-index: 2; } .wrapper .swing .human .top-part .head .hair { position: absolute; top: -5px; left: -10px; background: black; width: 22px; height: 44px; border-top-right-radius: 0%; border-top-left-radius: 100%; border-bottom-right-radius: 75%; border-bottom-left-radius: 10%; z-index: 2; } .wrapper .swing .human .top-part .head .fringe .........完整代码请登录后点击上方下载按钮下载查看
网友评论0