CSS实现小球跳动效果
CSS实现小球跳动效果
<style type="text/css"> .bound { animation-duration: 1s; } .ball { animation-duration: .75s; } .dot { animation-duration: .25s; } .dot { top: 100%; height: 50%; width: 50%; background-color: #fff; transform: translate(0, -50%); animation-name: drop; } .ball { top: 100%; height: 50%; width: 50%; transform: translate(0, -50%); animation-name: drop, roundround; } .bound { top: 0; animation-name: playalong, roundround; } .wrapper { position: relative; margin: auto; width: 100%; overflow: hidden; } .wrapper:before { content: ""; display: block; padding-top: 100%; } .bound, .ball, .dot { position: absolute; margin: auto; animation-delay: 0; animation-direction: alternate; animation-iteration-count: infinite; animation-timing-function: ease-in-out; animation-play-state: running; right: 0%; bottom: 0%; left: 0%; border-radius: 50%; } body { margin: 0; background: black; } * { box-sizing: border-box; } @keyframes playalong { from { height: 100%; width: 100%; } to { height: 10%; width: 10%; } } @keyframes roundround { to { transform: rotate(360deg); } } @keyframes drop { to { top: 0%; bottom: 80%; transform: scale(.25); } } @media (orientation: landscape) { .wrapper { width: 100vh; } } @media (orientation: portrait) { .wrapper { top: 50%; -ms-transform:translateY(-50%); -webkit-transform:translateY(-50%); -moz-transform:translateY(-50%); -o-transform:translateY(-50%); transform:translateY(-50%); } body{ height:100vh; } } @-ms-viewport { width: device-width; } @viewport { zoom: 1.0; width: device-width; } </style> <div class="wrapper"> <div class="bound"> <span class="ball"> <span class="dot"></span> </span> </div> </div>
.
相关推荐
MaureenChen 2019-10-25
sunshineboyleng 2020-07-08
impress 2020-05-11
yaodilu 2020-04-30
/*垂直居中,div上边界距离窗口上边的距离为窗口高度的50%,并针对不同浏览器进行兼容。-- 在外层添加一个div,把行内容居中,添加.row .justify-content-center -->
Phoebe的学习天地 2020-04-14
福叔 2020-04-11
zjuwangleicn 2020-03-08
冰蝶 2020-03-01
somboy 2020-02-29
zengni 2020-02-23
wangjie 2020-02-22
tianzyc 2020-02-19
冰蝶 2020-02-16
lanzhusiyu 2020-02-03
lanzhusiyu 2020-01-12
MaureenChen 2020-01-01
jiedinghui 2019-12-27
zhanghao 2019-12-20