css布局实现一个闹钟动画效果
代码语言:html
所属分类:动画
代码描述:css布局实现一个闹钟动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> /************* background ***********/ body { margin: 0; background-color: #e46b4c; padding-top: 170px; } .table { background-color: #2B3948; height: 50vh; } .clock { margin: 0 auto; position: relative; top: 0; left: 0; right: 0; bottom: 0; background-color: #fff; width: 200px; height: 200px; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; -webkit-border: #2B3948 solid 15px; -moz-border: #2B3948 solid 15px; border: #2B3948 solid 15px; } /************* time-ticks ***********/ .hours { width: 8px; height: 3px; background-color: #2B3948; position: absolute; margin: auto 0; } .hours2 { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; } .top { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; left: 0; right: 0; } .bottom { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; bottom: 0; left: 0; right: 0; } .left { width: 8px; height: 3px; background-color: #2B3948; position: absolute; margin: auto 0; top: 0; bottom: 0; left: 0; } .right { width: 8px; height: 3px; background-color: #2B3948; position: absolute; margin: auto 0; bottom: 0; top: 0; right: 0; } .quarter-first { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; top: 30px; left: 0; right: -140px; -webkit-transform: rotate(40deg); -moz-transform: rotate(40deg); -ms-transform: rotate(40deg); -o-transform: rotate(40deg); transform: rotate(40deg); } .quarter-second { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; bottom: 30px; left: 0; right: -140px; -webkit-transform: rotate(140deg); -moz-transform: rotate(140deg); -ms-transform: rotate(140deg); -o-transform: rotate(140deg); transform: rotate(140deg); } .quarter-third { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; bottom: 30px; left: 0; right: 140px; -webkit-transform: rotate(40deg); -moz-transform: rotate(40deg); -ms-transform: rotate(40deg); -o-transform: rotate(40deg); transform: rotate(40deg); } .quarter-fourth { width: 3px; height: 8px; background-color: #2B3948; position: absolute; margin: 0 auto; top: 30px; left: 0; right: 140px; -webkit-transform: rotate(140deg); -moz-transform: rotate(140deg); -ms-transform: rotate(140deg); -o-transform: rotate(140deg); transform: rotate(140deg); } /************* body ***********/ .arm { position: absolute; top: -65px; z-index: -1; background: #161d24; -webkit-border-radius: 50px; -moz-border-radius: 50px; border-radius: 50px; width: 20px; height: 308px; } .arm1 { position: absolute; top: -65px; z-index: -1; background: #161d24; -webkit-border-radius: 50px; -moz-border-radius: 50px; border-radius: 50px; width: 20px; height: 308px; left: 80px; -webkit-transform: rotate(-39deg); -moz-transform: rotate(-39deg); -ms-transform: rotate(-39deg); -o-transform: rotate(-39deg); transform: rotate(-39deg); } .arm2 { position: absolute; top: -65px; z-index: -1; background: #161d24; -webkit-border-radius: 50px; -moz-border-radius: 50px; border-radius: 50px; width: 20px; height: 308px; right: 80px; -webkit-transform: rotate(39deg); -moz-transform: rotate(39deg); -ms-transform: rotate(39deg); -o-transform: rotate(39deg); transform: rotate(39deg); } .bell { position: absolute; z-index: 2; background: #2B3948; border-radius: 50% 50% 10% 10%; width: 85px; height: 43px; top: -30px; } .bell1 { position: absolute; z-index: 2; background: #2B3948; border-radius: 50% 50% 10% 10%; width: 85px; height: 43px; top: -30px; -webkit-transform: rotate(-34deg); -moz-transform: rotate(-34deg); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0