{"id":331,"date":"2015-12-17T16:15:26","date_gmt":"2015-12-17T09:15:26","guid":{"rendered":"http:\/\/www.uptoyou.life\/article\/?p=331"},"modified":"2025-08-15T15:56:20","modified_gmt":"2025-08-15T08:56:20","slug":"%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%88%e0%b8%b1%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%84%e0%b8%a5%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%ab%e0%b8%a7event-motion-%e0%b8%82","status":"publish","type":"post","link":"http:\/\/www.uptoyou.life\/article\/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%88%e0%b8%b1%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%84%e0%b8%a5%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%ab%e0%b8%a7event-motion-%e0%b8%82\/","title":{"rendered":"\u0e01\u0e32\u0e23\u0e08\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e40\u0e04\u0e25\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e2b\u0e27(Event Motion) \u0e02\u0e2d\u0e07\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d (Smart Phone)"},"content":{"rendered":"<p>\u0e01\u0e32\u0e23\u0e08\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e2b\u0e27\u0e2b\u0e23\u0e37\u0e2d\u0e17\u0e35\u0e48\u0e40\u0e23\u0e35\u0e22\u0e01\u0e27\u0e48\u0e32 Event Motion \u00a0\u0e02\u0e2d\u0e07\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d\u0e21\u0e35\u0e21\u0e32\u0e19\u0e32\u0e19\u0e41\u0e25\u0e49\u0e27 \u00a0(\u0e41\u0e15\u0e48\u0e1c\u0e21\u0e40\u0e1e\u0e34\u0e48\u0e07\u0e23\u0e39\u0e49\u0e44\u0e21\u0e48\u0e19\u0e32\u0e19\u0e21\u0e32\u0e19\u0e35\u0e49 \u00a0\u0e15\u0e01\u0e40\u0e17\u0e23\u0e19\u0e44\u0e1b\u0e2b\u0e25\u0e32\u0e22\u0e02\u0e38\u0e21\u0e40\u0e25\u0e22 \u0e2e\u0e48\u0e32\u0e46) \u00a0\u0e41\u0e15\u0e48\u0e2a\u0e48\u0e27\u0e19\u0e43\u0e2b\u0e0d\u0e48\u0e19\u0e34\u0e22\u0e21\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e01\u0e32\u0e23\u0e17\u0e33 Application \u00a0\u0e1a\u0e19 \u00a0IOS \u0e2b\u0e23\u0e37\u0e2d Android \u0e0b\u0e30\u0e21\u0e32\u0e01\u0e01\u0e27\u0e48\u0e32 \u00a0 \u00a0\u0e41\u0e15\u0e48\u0e08\u0e23\u0e34\u0e07\u0e46\u0e41\u0e25\u0e49\u0e27\u0e43\u0e19 Website \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e43\u0e19\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d\u0e41\u0e25\u0e49\u0e27\u0e43\u0e0a\u0e49 Browser \u0e43\u0e19\u0e01\u0e32\u0e23\u0e2d\u0e48\u0e32\u0e19\u0e01\u0e47\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e17\u0e33\u0e44\u0e14\u0e49<\/p>\n<p>\u0e0b\u0e36\u0e48\u0e07\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e01\u0e47\u0e21\u0e35\u0e2b\u0e25\u0e32\u0e22\u0e17\u0e35\u0e48\u0e40\u0e0a\u0e48\u0e19\u0e01\u0e31\u0e19\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49\u0e40\u0e23\u0e34\u0e48\u0e21\u0e17\u0e33\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e39\u0e1b\u0e23\u0e48\u0e32\u0e07 \u00a0\u0e43\u0e19\u0e41\u0e1a\u0e1a\u0e15\u0e48\u0e32\u0e07\u0e46 \u00a0\u0e0b\u0e36\u0e48\u0e07\u0e27\u0e34\u0e18\u0e35\u0e01\u0e32\u0e23\u0e01\u0e47\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e0b\u0e31\u0e1a\u0e0b\u0e49\u0e2d\u0e19\u0e2d\u0e30\u0e44\u0e23\u0e40\u0e1e\u0e35\u0e22\u0e07\u0e41\u0e04\u0e48\u0e21\u0e35\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 \u00a0Event \u0e2b\u0e25\u0e31\u0e01\u0e46 \u00a02 \u00a0Event \u00a0\u0e04\u0e37\u0e2d<br \/>\n1. \u00a0deviceorientation \u00a0\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e21\u0e35\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e01\u0e19\u0e42\u0e14\u0e22\u0e01\u0e32\u0e23\u0e2b\u0e21\u0e38\u0e19 \u00a0\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e35\u0e22\u0e19\u0e17\u0e14\u0e2a\u0e2d\u0e1a\u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n<pre class=\"lang:js decode:true \">window.addEventListener('deviceorientation', function(event) {\n  var alpha = event.alpha;\n  var beta = event.beta;\n  var gamma = event.gamma;\n  \/\/ Do something\n}, false);<\/pre>\n<p><!--more-->2. \u00a0devicemotion \u00a0\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e21\u0e35\u0e01\u0e32\u0e23\u0e40\u0e04\u0e25\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e2b\u0e27 \u00a0\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e35\u0e22\u0e19\u0e17\u0e14\u0e2a\u0e2d\u0e1a\u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n<pre class=\"lang:js decode:true\">window.addEventListener('devicemotion', function(event) {\n  var x = event.acceleration.x;\n  var y = event.acceleration.y;\n  var z = event.acceleration.z;\n \n  var ralpha = event.rotationRate.alpha;\n  var rbeta = event.rotationRate.beta;\n  var rgamma = event.rotationRate.gamma;\n \n  var interval = event.interval;\n});<\/pre>\n<p>Simple : <a href=\"http:\/\/uptoyou.life\/other\/test\/mobile_motion.php\">\u00a0http:\/\/uptoyou.life\/other\/test\/mobile_motion.php<\/a>\u00a0(\u0e41\u0e2a\u0e14\u0e07\u0e1c\u0e25\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e43\u0e19 Smart phone \u0e2b\u0e23\u0e37\u0e2d Tab \u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e48\u0e19\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a)<\/p>\n<p>\u0e40\u0e23\u0e32\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e33\u0e27\u0e34\u0e18\u0e35\u0e40\u0e2b\u0e25\u0e48\u0e32\u0e19\u0e35\u0e49\u0e44\u0e1b\u0e1b\u0e23\u0e30\u0e22\u0e38\u0e01\u0e04\u0e4c\u0e43\u0e0a\u0e49\u0e17\u0e33\u0e2a\u0e34\u0e48\u0e07\u0e15\u0e48\u0e32\u0e07\u0e46\u0e44\u0e14\u0e49\u0e21\u0e32\u0e01\u0e21\u0e32\u0e22\u0e42\u0e14\u0e22\u0e01\u0e32\u0e23\u0e40\u0e02\u0e35\u0e22\u0e19\u0e40\u0e1e\u0e35\u0e22\u0e07\u0e41\u0e04\u0e48 \u00a0Javascript \u0e44\u0e21\u0e48\u0e08\u0e33\u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e2d\u0e07\u0e40\u0e02\u0e35\u0e22\u0e19 Application \u00a0\u0e40\u0e0a\u0e48\u0e19\u0e40\u0e27\u0e1b\u0e40\u0e02\u0e47\u0e21\u0e17\u0e34\u0e28<\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;style&gt;\n      #compass{\n        width:100%;\n        transform-origin: 50% 50%;\n        -webkit-transform-origin: 50% 50%;\n        -moz-transform-origin: 50% 50%;\n      }\n    &lt;\/style&gt;\n    &lt;script&gt;\n      function init() {\n        var compass = document.getElementById('compass');\n        if(window.DeviceOrientationEvent) {\n \n          window.addEventListener('deviceorientation', function(event) {\n                var alpha;\n                \/\/Check for iOS property\n                if(event.webkitCompassHeading) {\n                  alpha = event.webkitCompassHeading;\n                  \/\/Rotation is reversed for iOS\n                  compass.style.WebkitTransform = 'rotate(-' + alpha + 'deg)';\n                }\n                \/\/non iOS\n                else {\n                  alpha = event.alpha;\n                  webkitAlpha = alpha;\n                  if(!window.chrome) {\n                    \/\/Assume Android stock (this is crude, but good enough for our example) and apply offset\n                    webkitAlpha = alpha-270;\n                  }\n                }\n \n                compass.style.Transform = 'rotate(' + alpha + 'deg)';\n                compass.style.WebkitTransform = 'rotate('+ webkitAlpha + 'deg)';\n                \/\/Rotation is reversed for FF\n                compass.style.MozTransform = 'rotate(-' + alpha + 'deg)'; \n              }, false);\n        }\n      }\n    &lt;\/script&gt;\n  &lt;\/head&gt;\n  &lt;body onload=\"init()\"&gt;\n    &lt;div id=\"compassContainer\"&gt;\n      &lt;img src=\"compass.jpg\" id=\"compass\"\/&gt;\n    &lt;\/div&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p>Simple :\u00a0<a href=\"http:\/\/uptoyou.life\/other\/test\/mobile_motion_pin.php\">http:\/\/uptoyou.life\/other\/test\/mobile_motion_pin.php<\/a>\u00a0(\u0e41\u0e2a\u0e14\u0e07\u0e1c\u0e25\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e43\u0e19 Smart phone \u0e2b\u0e23\u0e37\u0e2d Tab \u0e40\u0e17\u0e48\u0e32\u0e19\u0e31\u0e48\u0e19\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a)<\/p>\n<p>\u0e40\u0e17\u0e48\u0e32\u0e19\u0e35\u0e49\u0e01\u0e47\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e25\u0e38\u0e01\u0e40\u0e25\u0e48\u0e19\u0e15\u0e48\u0e32\u0e07\u0e46\u0e43\u0e2b\u0e49\u0e01\u0e31\u0e1a\u0e07\u0e32\u0e19\u0e41\u0e25\u0e30\u0e41\u0e19\u0e27\u0e04\u0e34\u0e14\u0e43\u0e2b\u0e21\u0e48\u0e46\u0e02\u0e2d\u0e07\u0e40\u0e23\u0e32\u0e44\u0e14\u0e49\u0e41\u0e25\u0e49\u0e27\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a \u00a0\u0e02\u0e2d\u0e43\u0e2b\u0e49\u0e2a\u0e19\u0e38\u0e01\u0e01\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a ^^<\/p>\n<hr \/>\n<p>\u0e2d\u0e49\u0e32\u0e07\u0e2d\u0e34\u0e07 \u00a0:\u00a0<a href=\"https:\/\/mobiforge.com\/design-development\/html5-mobile-web-device-orientation-events\">https:\/\/mobiforge.com\/design-development\/html5-mobile-web-device-orientation-events<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e01\u0e32\u0e23\u0e08\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e2b\u0e27\u0e2b\u0e23\u0e37\u0e2d\u0e17\u0e35\u0e48\u0e40\u0e23\u0e35\u0e22\u0e01\u0e27\u0e48\u0e32 Event Motion \u00a0\u0e02\u0e2d\u0e07\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d\u0e21\u0e35\u0e21\u0e32\u0e19\u0e32\u0e19\u0e41\u0e25\u0e49\u0e27 \u00a0(\u0e41\u0e15\u0e48\u0e1c\u0e21\u0e40\u0e1e\u0e34\u0e48\u0e07\u0e23\u0e39\u0e49\u0e44\u0e21\u0e48\u0e19\u0e32\u0e19\u0e21\u0e32\u0e19\u0e35\u0e49 \u00a0\u0e15\u0e01\u0e40\u0e17\u0e23\u0e19\u0e44\u0e1b\u0e2b\u0e25\u0e32\u0e22\u0e02\u0e38\u0e21\u0e40\u0e25\u0e22 \u0e2e\u0e48\u0e32\u0e46) \u00a0\u0e41\u0e15\u0e48\u0e2a\u0e48\u0e27\u0e19\u0e43\u0e2b\u0e0d\u0e48\u0e19\u0e34\u0e22\u0e21\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e01\u0e32\u0e23\u0e17\u0e33 Application \u00a0\u0e1a\u0e19 \u00a0IOS \u0e2b\u0e23\u0e37\u0e2d Android \u0e0b\u0e30\u0e21\u0e32\u0e01\u0e01\u0e27\u0e48\u0e32 \u00a0 \u00a0\u0e41\u0e15\u0e48\u0e08\u0e23\u0e34\u0e07\u0e46\u0e41\u0e25\u0e49\u0e27\u0e43\u0e19 Website \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e34\u0e14\u0e43\u0e19\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d\u0e41\u0e25\u0e49\u0e27\u0e43\u0e0a\u0e49 Browser \u0e43\u0e19\u0e01\u0e32\u0e23\u0e2d\u0e48\u0e32\u0e19\u0e01\u0e47\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e17\u0e33\u0e44\u0e14\u0e49 \u0e0b\u0e36\u0e48\u0e07\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e01\u0e47\u0e21\u0e35\u0e2b\u0e25\u0e32\u0e22\u0e17\u0e35\u0e48\u0e40\u0e0a\u0e48\u0e19\u0e01\u0e31\u0e19\u0e17\u0e35\u0e48\u0e44\u0e14\u0e49\u0e40\u0e23\u0e34\u0e48\u0e21\u0e17\u0e33\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e39\u0e1b\u0e23\u0e48\u0e32\u0e07 \u00a0\u0e43\u0e19\u0e41\u0e1a\u0e1a\u0e15\u0e48\u0e32\u0e07\u0e46 \u00a0\u0e0b\u0e36\u0e48\u0e07\u0e27\u0e34\u0e18\u0e35\u0e01\u0e32\u0e23\u0e01\u0e47\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e0b\u0e31\u0e1a\u0e0b\u0e49\u0e2d\u0e19\u0e2d\u0e30\u0e44\u0e23\u0e40\u0e1e\u0e35\u0e22\u0e07\u0e41\u0e04\u0e48\u0e21\u0e35\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 \u00a0Event \u0e2b\u0e25\u0e31\u0e01\u0e46 \u00a02 \u00a0Event \u00a0\u0e04\u0e37\u0e2d 1. \u00a0deviceorientation \u00a0\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e21\u0e35\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e01\u0e19\u0e42\u0e14\u0e22\u0e01\u0e32\u0e23\u0e2b\u0e21\u0e38\u0e19 \u00a0\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e35\u0e22\u0e19\u0e17\u0e14\u0e2a\u0e2d\u0e1a\u0e44\u0e14\u0e49\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49 window.addEventListener(&#8216;deviceorientation&#8217;, function(event) { var alpha = event.alpha; var beta = event.beta; var gamma = event.gamma; \/\/ Do something }, false);<\/p>\n","protected":false},"author":1,"featured_media":333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[43,41,42,44],"class_list":["post-331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-javascript","tag-event","tag-javascript","tag-mobile","tag-motion"],"_links":{"self":[{"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/posts\/331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/comments?post=331"}],"version-history":[{"count":4,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/posts\/331\/revisions"}],"predecessor-version":[{"id":645,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/posts\/331\/revisions\/645"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/media?parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/categories?post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.uptoyou.life\/article\/wp-json\/wp\/v2\/tags?post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}