Spin wheel image in HTML5 (e.g., roulette wheel)?

你。 提交于 2019-11-30 12:19:53

问题


What's the best way to emulate a spinning roulette wheel in HTML5?

The wheel spinning should be controllable by some input (i.e., speed of spinning based on some user input). The wheel labels should blur as the wheel spins fast, but as the spinning slows, the labels on the wheel become more and more readable.

Are there HTML5 libraries that support this, or do the animations need to be programmed by hand?

This also needs to be supported on iOS devices.


回答1:


It can be done in a few lines of CSS.

  • http://jsfiddle.net/YNBxz/1/ – CSS-only (see in Chrome or Safari).
  • http://jsfiddle.net/YNBxz/2/ – with some JavaScript, to demonstrate how to customize the animation.

Blurring is an optical effect, it doesn't need to be simulated.




回答2:


If anyone is interested in doing this using Javascript and HTML5 canvas, see http://www.dougtesting.net/winwheel/index.html for an example. Cool thing is the code is available for download too.




回答3:


You can use jfortune, it is a jquery plugin. https://github.com/tehsis/jfortune

And I know that this could be a bit different from a round/wheel roulette perspective... but fancy-jqyery-plugin looks very interesting and customizable.

http://www.jqueryscript.net/animation/Fancy-jQuery-Plugin-For-Roulette-Image-roulette-js.html



来源:https://stackoverflow.com/questions/7668007/spin-wheel-image-in-html5-e-g-roulette-wheel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!