Home > Web Front-end > H5 Tutorial > html5 uses gravity sensing to realize shaking to change colors, which can be used for lottery draws, etc._html5 tutorial skills

html5 uses gravity sensing to realize shaking to change colors, which can be used for lottery draws, etc._html5 tutorial skills

WBOY
Release: 2016-05-16 15:48:01
Original
1393 people have browsed it

I found a case on the Internet, which is used to change colors by shaking. It is very easy to use. However, after testing, you need to pay attention to the following:

1. You must have ios or Android 4.0 or above to achieve this. Functional application.

2. If you add the z coordinate judgment, the screen will change color randomly. It is probably too sensitive...or the correct usage is not found. I hope everyone can correct me

3. With slight modifications to this function, it can be turned into a lottery method, which is more fashionable than big carousels and scratch cards, haha

Copy Code
The code is as follows:


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template