[ImageRotation] initialize a package
authorJoonghun Park <jh718.park@samsung.com>
Mon, 20 May 2013 12:24:08 +0000 (21:24 +0900)
committerJoonghun Park <jh718.park@samsung.com>
Tue, 21 May 2013 06:01:27 +0000 (15:01 +0900)
Change-Id: I0e02fd498e4d30055a84dda6abc233df0ed53b2e

css/style.css [new file with mode: 0755]
icon.png [new file with mode: 0755]
images/tizen_logo_light.png [new file with mode: 0755]
index.html [new file with mode: 0755]
js/main.js [new file with mode: 0755]

diff --git a/css/style.css b/css/style.css
new file mode 100755 (executable)
index 0000000..5050a2e
--- /dev/null
@@ -0,0 +1,28 @@
+* {
+        margin: 0;
+        padding: 0;
+}
+
+h1 {
+        font-size: 1.4em;
+        margin: 10px 0 5px 10px;
+        color: #6587ac;
+}
+h1 + .desc {
+        font-size: 0.8em;
+        border-bottom: 2px solid #6587ac;
+        margin: 0 10px 20px;
+        color: #6587ac;
+}
+
+.holder {
+        text-align: center;
+        padding: 15px 0;
+        margin: 0 auto;
+        border: 2px dotted #d9d9d9;
+        perspective: 1000;
+        -webkit-perspective: 1000;
+}
+.holder img {
+        max-width: 100%;
+}
diff --git a/icon.png b/icon.png
new file mode 100755 (executable)
index 0000000..647c3f9
Binary files /dev/null and b/icon.png differ
diff --git a/images/tizen_logo_light.png b/images/tizen_logo_light.png
new file mode 100755 (executable)
index 0000000..572669f
Binary files /dev/null and b/images/tizen_logo_light.png differ
diff --git a/index.html b/index.html
new file mode 100755 (executable)
index 0000000..2704d8c
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+    <meta name="description" content="Tizen basic template generated by Tizen Web IDE"/>
+
+    <title>Device Orientation - Device Image Rotation</title>
+
+    <link rel="stylesheet" type="text/css" href="css/style.css"/>
+    <script src="js/main.js"></script>
+</head>
+
+<body>
+    <h1>DEVICE IMAGE ROTATION</h1>
+
+    <div class="holder">
+       <img id="logo" src="images/tizen_logo_light.png" alt="Tizen logo">
+    </div>
+
+    <p id="alpha"></p>
+    <p id="beta"></p>
+    <p id="gamma"></p>
+</body>
+</html>
diff --git a/js/main.js b/js/main.js
new file mode 100755 (executable)
index 0000000..ef545a0
--- /dev/null
@@ -0,0 +1,23 @@
+function deviceOrientationEvents() {
+        var alphaElem = document.getElementById("alpha");
+        var betaElem =document.getElementById("beta");
+        var gammaElem = document.getElementById("gamma");
+        var logoImg = document.getElementById("logo");
+        var rotateY = 0, rotateX = 0;
+
+        window.addEventListener("deviceorientation", handleDeviceOrientation, false);
+
+        function handleDeviceOrientation(e) {
+                rotateX = ('rotateX(' + e.beta * 1.2 + 'deg)')
+                rotateY = ('rotateY(' + e.gamma * 1.2 + 'deg)')
+
+                //Style insert
+                logoImg.style.webkitTransform = rotateY + ' ' + rotateX
+
+                alphaElem.innerHTML ="alpha value "+ Math.round(e.alpha);
+                betaElem.innerHTML = "beta value "+ Math.round(e.beta);
+                gammaElem.innerHTML = "gamma value "+ Math.round(e.gamma);
+        }
+}
+
+window.onload = function() {deviceOrientationEvents();};