css - How to make responsive png sequence? -
i trying make responsive png sequences.
my tried code here. wrong code?
1. if removed background-size :100%; shows image until , unless invisible.
2. not responsive. (if comment background-size :100%) css
.eye { position: relative; width: 70%; margin: -10% auto 0 auto; /* positioning tweak */ } .pngseq{ position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: url('http://arnoculus.com/img/eye-sprite.png') no-repeat 0 0%; background-size: 100%; animation: play 3s steps(58) infinite; } @-webkit-keyframes play { { background-position: 0px; } { background-position: -30740px; } } @-moz-keyframes play { { background-position: 0px; } { background-position: -30740px; } } @-ms-keyframes play { { background-position: 0px; } { background-position: -30740px; } } @-o-keyframes play { { background-position: 0px; } { background-position: -30740px; } } @keyframes play { { background-position: 0px; } { background-position: -30740px; } }
html
<div class="eye"> <div class="pngseq"> </div> </div>
you have several mistakes...
here code working
.eye { position: relative; width: 70%; height: 800px; background-color: red; margin: -10% auto 0 auto; /* positioning tweak */ } .pngseq{ position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: url('http://arnoculus.com/img/eye-sprite.png') no-repeat 0 0%; background-size: 5800%; animation: play 3s steps(57) infinite; } @keyframes play { { background-position: 0px 0px; } { background-position: 100% 0px; } }
<div class="eye"> <div class="pngseq"> </div> </div>
it shaking bit, maybe original image isn't accurate, or maybe working percentages @ sizes has rounding error; don't know sure.
Comments
Post a Comment