html - Relative Spritesheet Animation in CSS -
i'm trying find best way animate sprite sheet in webpage using css; found example @ http://jsfiddle.net/simurai/cgmce/, rendering frame in absolute pixels of 50x72. need sizing relative can downscale animated sprite smaller sizes @ smaller screen resolutions; have tried swapping out absolute pixel values relative sizes, , changing background-position property in keyframe animation relative value, not seem work (the animation becomes wonky, seemingly moving 1 frame another, instead of playing should). help/advice appreciated.
.myanimationproperties { width: 25%; height: 25%; background-image: url("images/myspritesheet.png"); -webkit-animation: play .8s steps(6) infinite; -moz-animation: play .8s steps(6) infinite; -ms-animation: play .8s steps(6) infinite; -o-animation: play .8s steps(6) infinite; animation: play .8s steps(6) infinite; } @-webkit-keyframes play { { background-position: 0%; } { background-position: -100%; } } @-moz-keyframes play { { background-position: 0%; } { background-position: -100%; } } @-ms-keyframes play { { background-position: 0%; } { background-position: -100%; } } @-o-keyframes play { { background-position: 0%; } { background-position: -100%; } } @keyframes play { { background-position: 0%; } { background-position: -100%; } }
what if change background-size
smaller screens?
Comments
Post a Comment