Todd thought a prize ball would be an exciting way to deliver these prizes. We could use canvas to do this, but today, just for fun, I decided to experiment with CSS key frames and use the DOM instead.
I had read about these on several occasions, but haven't tried them yet. It was much simpler to implement than similar code I could conjure up in JavaScript to do the same thing (example is for webkit browsers):
@-webkit-keyframes ballroll { from {left: -25%; -webkit-transform:rotate(-1440deg);} 50% {left: 125%; -webkit-transform:rotate(0deg);} to {left: -25%; -webkit-transform:rotate(-1440deg);} } .prize-ball-roll { position: absolute; height: 75px; width: 75px; bottom: 0px; left: -25%; z-index: 20; -webkit-animation: ballroll 4s ease-in-out infinite; }
If you are viewing this post in a browser that supports key frames, you should see a prize ball rolling across the blog. How cool is that!?!