Device Orientation Demo02

Developer
Size
2,343 Kb
Views
18,216

How do I make an device orientation demo02?

What is a device orientation demo02? How do you make a device orientation demo02? This script and codes were developed by Ken Smith on 04 November 2022, Friday.

Device Orientation Demo02 Previews

Device Orientation Demo02 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Device Orientation Demo02</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Device Orientation - Demo02</h1>
<h2>Device Orientation with HTML5 | <a href="http://www.onlywebpro.com/2011/06/11/introduction-to-device-orientation-with-html5/">onlywebpro.com</a></h2>
<h3>Also see on <a href="http://kennethbsmith.com/bonus/pan/device-orientation02.html">kbs.com</a></h3> <img src="http://www.onlywebpro.com/wp-content/uploads/2011/10/test_img.png" id="imgLogo" class="logo"> <script src="js/index.js"></script>
</body>
</html>

Device Orientation Demo02 - Script Codes CSS Codes

 h1 { font-family: verdana, sans-serif; font-weight: bold; font-size: 28px; } p { font-family: verdana, sans-serif; font-size: 12px; } #canvas { width: 200px; height: 200px; border: 5px solid #ddd; border-radius: 10px; -moz-border-radius: 10px; } #middle { background-color: #aaa; position: relative; width: 4px; height: 4px; left: 98px; top: 98px; } #ball { background-color: green; position: relative; width: 20px; height: 20px; left: 90px; top: 90px; border-radius: 20px; -moz-border-radius: 20px; box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.4); -moz-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.4); -webkit-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.4); background-image: -moz-linear-gradient(top, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 12px); background-image: -webkit-gradient(linear, 0 0, 0 12, from(rgba(255, 255, 255, .5)), to(rgba(255, 255, 255, 0))); } #warning { display: none; padding: 5px 10px; font-weight: bold;

Device Orientation Demo02 - Script Codes JS Codes

if (window.DeviceOrientationEvent) { console.log("DeviceOrientation is supported"); window.addEventListener('deviceorientation', function(eventData) { var LR = eventData.gamma; var FB = eventData.beta; var DIR = eventData.alpha; deviceOrientationHandler(LR, FB, DIR); }, false);
} else { alert("Not supported on your device or browser. Sorry.");
}
function deviceOrientationHandler(LR, FB, DIR) { //for webkit browser document.getElementById("imgLogo").style.webkitTransform = "rotate("+ LR +"deg) rotate3d(1,0,0, "+ (FB*-1)+"deg)"; //for HTML5 standard-compliance document.getElementById("imgLogo").style.transform = "rotate("+ LR +"deg) rotate3d(1,0,0, "+ (FB*-1)+"deg)";
}
Device Orientation Demo02 - Script Codes
Device Orientation Demo02 - Script Codes
Home Page Home
Developer Ken Smith
Username kensmith
Uploaded November 04, 2022
Rating 3
Size 2,343 Kb
Views 18,216
Do you need developer help for Device Orientation Demo02?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Ken Smith (kensmith) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!