css布局实现打击类摇滚音乐演奏动画效果代码
代码语言:html
所属分类:动画
代码描述:css布局实现打击类摇滚音乐演奏动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .wrapper { position: absolute; width: 280px; height: 280px; margin: auto; top: calc(50% - 140px); left: calc(50% - 140px); } .drum { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .rim { position: absolute; width: 100%; height: 100%; } .rim div { position: absolute; left: -3px; width: calc(100% + 6px); height: 3px; border-radius: 10px; background: #C2B0A3; } .rug { position: absolute; width: 100%; height: 100%; } .rug div { position: absolute; width: 5px; height: 12px; background: #C2B0A3; } .rug div:before { left: 2px; width: 1px; height: 12px; background: #C2B0A3; } .rug div.top:before { top: -10px; } .rug div.bottom:before { bottom: -10px; } .bass { position: absolute; top: 155px; left: 65px; width: 120px; height: 120px; } .bass .head { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; background: #E9DFD2; border: 3px solid #C2B0A3; -webkit-overflow: hidden; -moz-overflow: hidden; -ms-overflow: hidden; -o-overflow: hidden; overflow: hidden; -ms-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; -webkit-animation: bass 2s linear infinite; animation: bass 2s linear infinite; -webkit-animation-fill-mode: both; animation-fill-mode: both; } .bass .head:before { top: -85px; left: -98px; width: 206%; height: 149%; background: #F7ECDC; border-radius: 50%; transform: rotate(55deg); } .bass span { position: absolute; display: block; bottom: 4px; width: 5px; height: 10px; background: #C2B0A3; } .bass span:after { top: 10px; left: -1px; width: 7px; height: 12px; background: #585552; } .bass span:nth-of-type(1) { left: 20px; transform: rotate(30deg); } .bass span:nth-of-type(2) { right: 20px; transform: rotate(-30deg); } .floor { position: absolute; top: 152px; left: 40px; width: 52px; height: 90px; } .floor .tam { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #2e2d2b; -ms-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; -webkit-overflow: hidden; -moz-overflow: hidden; -ms-overflow: hidden; -o-overflow: hidden; overflow: hidden; } .floor .tam:before { top: -25px; left: -2px; width: 150%; height: 122%; background: #45413C; border-radius: 50%; } .floor .tam .rim div:nth-of-type(1) { top: 0; } .floor .tam .rim div:nth-of-type(2) { bottom: 0; } .floor .tam .rug div:nth-of-type(1) { top: 10px; left: 8px; } .floor .tam .rug div:nth-of-type(2) { top: 10px; right: 8px; } .floor .tam .rug div:nth-of-type(3) { bottom: 10px; left: 8px; } .floor .tam .rug div:nth-of-type(4) { bottom: 10px; right: 8px; } .floor span { position: absolute; display: block; bottom: -30px; width: 5px; height: 54px; background: #C2B0A3; } .floor span:before { top: 7px; left: -2px; width: 10px; height: 12px; background: #585552; } .floor span:after { top: 45px; left: -1px; width: 7px; height: 19px; background: #585552; } .floor span:nth-of-type(1) { left: -8px; transform: rotate(6deg); } .floor span:nth-of-type(2) { right: -8px; transform: rotate(-6deg); } .snare { position: absolute; top: 145px; left: 140px; width: 60px; height: 30px; } .snare .tam { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #2e2d2b; transform: rotate(-9deg); -webkit-overflow: hidden; -moz-overflow: hidden; -ms-overflow: hidden; -o-overflow: hidden; overflow: hidden; -ms-box-sizing: border-box; -o-box-sizing: border-box; box-sizing: border-box; -webkit-animation: snare 4s linear infinite; animation: snare 4s linear infinite; -webkit-animation-fill-mode: both; animation-fill-mode: both; } .snare .tam:before { top: -15px; left: -35px; width: 150%; height: 122%; background: #45413C; border-radius: 50%; } .snare .tam .rim div:nth-of-type(1) { top: 0; } .snare .tam .rim div:nth-of-type(2) { bottom: 0; } .snare .tam .rug div:nth-of-type(1) { top: 10px; left: 12px; } .snare .tam .rug div:nth-of-type(2) { top: 10px; right: 12px; } .snare .tam .rug div:nth-of-type(3) { bottom: 10px; left: 12px; } .snare .tam .rug div:nth-of-type(4) { bottom: 10px; right: 12px; } .snare span { position: absolute; display: block; bottom: -109px; width: 5px; height: 45px; background: #C2B0A3; } .snare span:after { top: 33px; left: -1px; width: 7px; height: 13px; background: #585552; } .snare span:nth-of-type(1) { left: 26px; bottom: -109px; width: 5px; height: 110px; transform: rotate(0); } .snare span:nth-of-type(1):before { top: 57px; left: -3px; width: 11px; height: 8px; background: #585552; } .snare span:nth-of-type(1):after { top: 98px; } .snare span:nth-of-type(2) { right: 19px; transform: rotate(-23deg); } .snare span:nth-of-type(3) { left: 16px; transform: rotate(23deg); } .hightam { position: absolute; top: 114px; left: 90px; width: 45px; height: 40px; } .hightam .tam { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #2e2d2b; transform: rotate(14deg);.........完整代码请登录后点击上方下载按钮下载查看
网友评论0