This is a modern proof of concept casino slot machine game, built using only vanilla HTML, CSS and JavaScript. No Flash or Frameworks required. Allowing for an amazing low bundle size and blazing fast performance. Built using the Web Animations API. I have a small assignment to create something like slot machine with spinning pictures. I have to use HTML5 Canvas. I would like to hear some opinions how this can be made simply and performantly.
/** |
* Quick and easy CSS3 rolling-number/slot machine? |
*/ |
body { |
font-size: 700%; /* with this setup you get 1:1 em , so 1em is actually number 1 */ |
} |
#counter { |
height: 1em; |
overflow: hidden; |
} |
.digits { |
float:left; |
list-style-type: none; |
font-size: 1em; |
line-height: 1em; |
} |
.digits-first { |
margin-top: -4em; /* number 4! */ |
} |
.digits-second { |
margin-top: 0em; /* number 0! */ |
} |
.digits-third { |
margin-top: -4em; /* number 4! */ |
} |
.digits { |
animation-duration: 2s; |
animation-timing-function: ease; |
animation-delay: 2.2s; |
animation-fill-mode: forwards; |
} |
.luckie { |
animation-name: luckie; |
} |
/* Animations */ |
@keyframes luckie { |
100% { |
margin-top: -7em; |
} |
} |
<!-- content to be placed inside <body>…</body> --> |
<divid='counter' class='animated'> |
<ulclass='digits digits-first luckie'><li> 0 <li> 1 <li> 2 <li> 3 <li> 4 <li> 5 <li> 6 <li> 7 <li> 8 <li> 9 </ul> |
<ulclass='digits digits-second luckie'><li> 0 <li> 1 <li> 2 <li> 3 <li> 4 <li> 5 <li> 6 <li> 7 <li> 8 <li> 9 </ul> |
<ulclass='digits digits-third luckie'><li> 0 <li> 1 <li> 2 <li> 3 <li> 4 <li> 5 <li> 6 <li> 7 <li> 8 <li> 9 </ul> |
</div> |
{'view':'split','fontsize':'100','seethrough':'','prefixfree':'1','page':'all'} |