SlideShare a Scribd company logo
1 of 34
Device (dis)Orientation?

                Luz Caballero
                @gerbille
• What is it?
• Some math you need to know
• Code
• Support and implementations
• Tips and tricks
• deviceorientation
• devicemotion
• compassneedscalibration
static / one off                                     dynamic / interactive


  * image sources: http://mygadgetnews.com/tech/apple-looking-to-radically-improve-maps-and-location-services-in-ios-5
                                                               http://www.sub5zero.com/top-10-racing-games-iphone/
deviceorientation
Code at: https://github.com/luzc/wiimote
QuickTime™ and a
           decompressor
 are needed to see this picture.




(back up plan!)
The math
Tait-Bryan angles
QuickTime™ and a
        GIF decompressor
are needed to see this picture.
If you want to apply a rotation:


 V = R(gamma, y’’).R(beta, x’).R(alpha, z).Vo

 V=                                             .Vo




           3rd            2nd            1st
alpha/gamma singularity
Disoriented much?
The code
server.js
       α, β, ɣ               α, β, ɣ

remote.js                         model.js
remote.js:




    var ws = new WebSocket('ws://10.112.0.139:8080/');
    //listen to device orientation
    window.addEventListener('deviceorientation', function(e) {
      if (ws.opened) {
        ws.send(JSON.stringify({
          alpha: e.alpha,
          beta: e.beta,
          gamma: e.gamma
        }));
      }
    });
model.js:




 window.addEventListener('DOMContentLoaded', function init() {
   //connect to server using websockets
   var ws = new WebSocket('ws://10.112.0.139:8080/');
   ws.onopen = function() {
     ws.onmessage = function(e) {
        var data = JSON.parse(e.data),
          avalue = data.alpha / 180 * Math.PI,
          bvalue = data.beta / 180 * Math.PI,
          gvalue = data.gamma / 180 * Math.PI;
          teapot.rotation.set(gvalue, avalue, -bvalue);
       };
    };
 });
Support
luzc.github.com/webtests/   • orientation
                            • compass
                            • motion
Tested running
                                                  ↑N                  ↑up                ↑up
luzc.github.com/webtests/orientation in a
Samsung Galaxy 2 and an iPhone (iOS6), on   α                     β                  ɣ
February 18, 2013




                                                       270                  0                  0
                                                360/0___|___180       -90___|___90   -90/270___|___90
   Chrome for Android
                                                         |                  |                   |
                                                        90                  0                 180
                                                     360/0                   0                 0
                                                 270___|___90         -90___|___90       -90___|___90
    Firefox for Android
                                                       |                     |                 |
                                                      180                -180/180              0
                                                     0/360                   0                 0
      Opera Mobile for                            90___|___270        -90___|___90       -90___|___90
         Android                                       |                     |                 |
                                                      180                -180/180              0
                                                     0/360                   0                 0
                                                  90___|___270        -90___|___90       -90___|___90
        Safari for iOS6
                                                       |                     |                  |
                                                      180                    0              -180/180
                                                     0/360                   0                 0
          Specification                           90___|___270        -90___|___90       -90___|___90
                                                       |                     |                 |
                                                      180                -180/180              0
Portrait vs. landscape
       matters!
Holding your device THE RIGTH WAY™




How FF thinks you should hold   How Opera (and Chrome) think
   your landscape device        you should hold your landscape
                                            device
BYO Calibration!!
You may want some buffering

https://github.com/richtr/Marine-Compass
devicemotion
• rotationRate
• acceleration
• accelerationIncludingGravity
• interval
run luzc.github.com/webtests/motion
in a Samsung Galaxy Tab 2 and iOS6


• acceleration (Safari)
• accelerationIncludingGravity (Safari, Opera, FF)
• rotationRate (Safari)
• interval (Opera, Safari, FF)
window.addEventListener('devicemotion', function(e)
{      if(e.acceleration){         //e.acceleration.x
       //e.acceleration.y
       //e.acceleration.z       }
       if(e.accelerationIncludingGravity)
       {//e.accelerationIncludingGravity.x
//e.accelerationIncludingGravity.y
       //e.accelerationIncludingGravity.z        }
       if(e.rotationRate){         //e.rotationRate.alpha
       //e.rotationRate.beta
       //e.rotationRate.gamma        }      if(e.interval){
       //e.interval       }    });
}    });
       }     });
       }     });
}    });
Things to remember:

   •   Angular position, angular speed and acceleration
   •   Intrinsic axes of rotation
   •   Rotations have to be applied *in order*
   •   Singularity in alpha/gamma
   •   3D libraries / languages can make your life easier
   •   Browser support but different implementations
   •   BYO calibration
   •   Portrait/landscape matters
   •   You may want some buffering
   •   Device motion has only partial support
That’s all :)


 Thanks!!

                Luz Caballero
                @gerbille
                github.com/luzc

More Related Content

Similar to Device dis(orientation)?

Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make itJonathan Snook
 
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Ruby Meditation
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
 
Beauty Treatment for your Android Application
Beauty Treatment for your Android ApplicationBeauty Treatment for your Android Application
Beauty Treatment for your Android ApplicationCodemotion
 
Agados biz. introductio
Agados biz. introductioAgados biz. introductio
Agados biz. introductioYongkyoo Park
 
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...Naoki (Neo) SATO
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Brian Moon
 
Designing for The Modern Web
Designing for The Modern WebDesigning for The Modern Web
Designing for The Modern WebSara Cannon
 
Make your animations perform well
Make your animations perform wellMake your animations perform well
Make your animations perform wellAnna Migas
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Andreas Bovens
 
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...Kontagent
 
Make web Magical with framer-motion
Make web Magical with framer-motionMake web Magical with framer-motion
Make web Magical with framer-motionAbderraouf GATTAL
 
UIWebViewでつくるUI
UIWebViewでつくるUIUIWebViewでつくるUI
UIWebViewでつくるUIcocopon
 
How to create 360 Image/panorama & share with WebVR?
How to create  360 Image/panorama & share with WebVR?How to create  360 Image/panorama & share with WebVR?
How to create 360 Image/panorama & share with WebVR?Fred Lin
 
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016将之 小野
 
Fearless From Monolith to Serverless with Dynatrace
Fearless From Monolith to Serverless with DynatraceFearless From Monolith to Serverless with Dynatrace
Fearless From Monolith to Serverless with DynatraceAmazon Web Services
 
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloudITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloudIstanbul Tech Talks
 
Make Your Testing Groovy
Make Your Testing GroovyMake Your Testing Groovy
Make Your Testing GroovyPaul King
 

Similar to Device dis(orientation)? (20)

Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Beauty Treatment for your Android Application
Beauty Treatment for your Android ApplicationBeauty Treatment for your Android Application
Beauty Treatment for your Android Application
 
Agados biz. introductio
Agados biz. introductioAgados biz. introductio
Agados biz. introductio
 
Web app
Web appWeb app
Web app
 
Web app
Web appWeb app
Web app
 
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...
[Azure Council Experts (ACE) 第6回定例会] Microsoft Azureアップデート情報 (2014/06/18-2014...
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Designing for The Modern Web
Designing for The Modern WebDesigning for The Modern Web
Designing for The Modern Web
 
Make your animations perform well
Make your animations perform wellMake your animations perform well
Make your animations perform well
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
 
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...
Feature Extraction for Predictive LTV Modeling using Hadoop, Hive, and Cascad...
 
Make web Magical with framer-motion
Make web Magical with framer-motionMake web Magical with framer-motion
Make web Magical with framer-motion
 
UIWebViewでつくるUI
UIWebViewでつくるUIUIWebViewでつくるUI
UIWebViewでつくるUI
 
How to create 360 Image/panorama & share with WebVR?
How to create  360 Image/panorama & share with WebVR?How to create  360 Image/panorama & share with WebVR?
How to create 360 Image/panorama & share with WebVR?
 
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
Swiftのこれまでの動向のまとめと 今後のさらなる発展の期待 - iOSDC 2016
 
Fearless From Monolith to Serverless with Dynatrace
Fearless From Monolith to Serverless with DynatraceFearless From Monolith to Serverless with Dynatrace
Fearless From Monolith to Serverless with Dynatrace
 
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloudITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
ITT 2015 - Vincent Garrigues - Continuous Integration at SoundCloud
 
Make Your Testing Groovy
Make Your Testing GroovyMake Your Testing Groovy
Make Your Testing Groovy
 

More from gerbille

Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todaygerbille
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLgerbille
 
Speed in the Opera mobile browsers
Speed in the Opera mobile browsersSpeed in the Opera mobile browsers
Speed in the Opera mobile browsersgerbille
 
Speed in the Opera mobile browsers
Speed in the Opera mobile browsersSpeed in the Opera mobile browsers
Speed in the Opera mobile browsersgerbille
 
What's new in the Opera mobile browsers
What's new in the Opera mobile browsersWhat's new in the Opera mobile browsers
What's new in the Opera mobile browsersgerbille
 
Developing HTML5 apps for TV
Developing HTML5 apps for TVDeveloping HTML5 apps for TV
Developing HTML5 apps for TVgerbille
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScriptersgerbille
 

More from gerbille (7)

Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
Speed in the Opera mobile browsers
Speed in the Opera mobile browsersSpeed in the Opera mobile browsers
Speed in the Opera mobile browsers
 
Speed in the Opera mobile browsers
Speed in the Opera mobile browsersSpeed in the Opera mobile browsers
Speed in the Opera mobile browsers
 
What's new in the Opera mobile browsers
What's new in the Opera mobile browsersWhat's new in the Opera mobile browsers
What's new in the Opera mobile browsers
 
Developing HTML5 apps for TV
Developing HTML5 apps for TVDeveloping HTML5 apps for TV
Developing HTML5 apps for TV
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Device dis(orientation)?

  • 1. Device (dis)Orientation? Luz Caballero @gerbille
  • 2. • What is it? • Some math you need to know • Code • Support and implementations • Tips and tricks
  • 4. static / one off dynamic / interactive * image sources: http://mygadgetnews.com/tech/apple-looking-to-radically-improve-maps-and-location-services-in-ios-5 http://www.sub5zero.com/top-10-racing-games-iphone/
  • 7. QuickTime™ and a decompressor are needed to see this picture. (back up plan!)
  • 9.
  • 11.
  • 12. QuickTime™ and a GIF decompressor are needed to see this picture.
  • 13. If you want to apply a rotation: V = R(gamma, y’’).R(beta, x’).R(alpha, z).Vo V= .Vo 3rd 2nd 1st
  • 17. server.js α, β, ɣ α, β, ɣ remote.js model.js
  • 18. remote.js: var ws = new WebSocket('ws://10.112.0.139:8080/'); //listen to device orientation window.addEventListener('deviceorientation', function(e) { if (ws.opened) { ws.send(JSON.stringify({ alpha: e.alpha, beta: e.beta, gamma: e.gamma })); } });
  • 19. model.js: window.addEventListener('DOMContentLoaded', function init() { //connect to server using websockets var ws = new WebSocket('ws://10.112.0.139:8080/'); ws.onopen = function() { ws.onmessage = function(e) { var data = JSON.parse(e.data), avalue = data.alpha / 180 * Math.PI, bvalue = data.beta / 180 * Math.PI, gvalue = data.gamma / 180 * Math.PI; teapot.rotation.set(gvalue, avalue, -bvalue); }; }; });
  • 21.
  • 22. luzc.github.com/webtests/ • orientation • compass • motion
  • 23. Tested running ↑N ↑up ↑up luzc.github.com/webtests/orientation in a Samsung Galaxy 2 and an iPhone (iOS6), on α β ɣ February 18, 2013 270 0 0 360/0___|___180 -90___|___90 -90/270___|___90 Chrome for Android | | | 90 0 180 360/0 0 0 270___|___90 -90___|___90 -90___|___90 Firefox for Android | | | 180 -180/180 0 0/360 0 0 Opera Mobile for 90___|___270 -90___|___90 -90___|___90 Android | | | 180 -180/180 0 0/360 0 0 90___|___270 -90___|___90 -90___|___90 Safari for iOS6 | | | 180 0 -180/180 0/360 0 0 Specification 90___|___270 -90___|___90 -90___|___90 | | | 180 -180/180 0
  • 25. Holding your device THE RIGTH WAY™ How FF thinks you should hold How Opera (and Chrome) think your landscape device you should hold your landscape device
  • 26.
  • 28. You may want some buffering https://github.com/richtr/Marine-Compass
  • 30. • rotationRate • acceleration • accelerationIncludingGravity • interval
  • 31. run luzc.github.com/webtests/motion in a Samsung Galaxy Tab 2 and iOS6 • acceleration (Safari) • accelerationIncludingGravity (Safari, Opera, FF) • rotationRate (Safari) • interval (Opera, Safari, FF)
  • 32. window.addEventListener('devicemotion', function(e) { if(e.acceleration){ //e.acceleration.x //e.acceleration.y //e.acceleration.z } if(e.accelerationIncludingGravity) {//e.accelerationIncludingGravity.x //e.accelerationIncludingGravity.y //e.accelerationIncludingGravity.z } if(e.rotationRate){ //e.rotationRate.alpha //e.rotationRate.beta //e.rotationRate.gamma } if(e.interval){ //e.interval } }); } }); } }); } }); } });
  • 33. Things to remember: • Angular position, angular speed and acceleration • Intrinsic axes of rotation • Rotations have to be applied *in order* • Singularity in alpha/gamma • 3D libraries / languages can make your life easier • Browser support but different implementations • BYO calibration • Portrait/landscape matters • You may want some buffering • Device motion has only partial support
  • 34. That’s all :) Thanks!! Luz Caballero @gerbille github.com/luzc