javascript - How to debug mobile specific movement events (beta, gamma, alpha) -
i going through code of particles.js , came across following lines of code:
if (orientationsupport && !desktop) { // map tiltx range [-30,30] range [0,winw] var ratiox = (winw - 0) / (30 - -30); pointerx = (tiltx - -30) * ratiox + 0; // map tilty range [-30,30] range [0,winh] var ratioy = (winh - 0) / (30 - -30); pointery = (tilty - -30) * ratioy + 0; } else { pointerx = mousex; pointery = mousey; }
the above lines of code can found here.
now particular plugin uses these mobile specific events tiny parallax.js, i've seen plugins use code similar above high tech parallax simulation.
now question is, because these can't tested on destop pc, how test such code @ all?
there multiple ways:
- have webserver , mobile can connect to. if js doesn't work, check console on pc, tell every error did.
- @andrew: use remote debugging on google chrome
- @choz: if need rotation can go dev-mode in google chrome [f12]
for other questions, it's worth take @ device orientation api.
Comments
Post a Comment