Upgrade to Pro — share decks privately, control downloads, hide ads and more …

スマホのセンサーをJavaScriptで遊ぶ

 スマホのセンサーをJavaScriptで遊ぶ

TOWNビアバッシュ 2017/6 公開

1e424524ccaf46f35fad0ecb39e91afc?s=128

Kazuyoshi Goto

June 28, 2017
Tweet

Transcript

  1. εϚϗͷηϯαʔΛ
 +BWB4DSJQUͰ༡Ϳ ޙ౻࿨ྑ

  2. εϚϗ͸ηϯαʔͷմɻ 
 +BWB4DSJQU͚ͩͰҾͬ͜ൈ ͚ΔͷͰࢼͯ͠Έͨɻ

  3. λονηϯαʔ 5PVDIFWFOUT (14 (FPMPDBUJPO"1* δϟΠϩηϯαʔ %FWJDF0SJFOUBUJPOFWFOUT Ճ଎౓ηϯαʔ %FWJDF.PUJPOFWFOUT র౓ηϯαʔ "NCJFOU-JHIU"1*

    ۙ઀ηϯαʔ 1SPYJNJUZ"1*
  4. λονηϯαʔ 5PVDIFWFOUT

  5. IUUQTHPPHMN[&WL

  6. λον͸ͭͷΠϕϯτͰर͑Δ  GVODUJPO \ UPVDITUBSUλονͨ࣌͠ XJOEPXBEE&WFOU-JTUFOFS UPVDITUBSU UPVDINPWF)BOEMFS GBMTF 

    UPVDINPWFλονঢ়ଶ͔Βυϥοάͨ࣌͠ XJOEPXBEE&WFOU-JTUFOFS UPVDINPWF UPVDINPWF)BOEMFS GBMTF  UPVDIFOEࢦ͕཭Εͨ࣌ XJOEPXBEE&WFOU-JTUFOFS UPVDIFOE UPVDIFOE)BOEMFS GBMTF  ^ 
  7. λονͨ࣌͠ɺυϥοάͨ࣌͠ GVODUJPOUPVDINPWF)BOEMFS FWFOU \ ಉ࣌λον਺ UPVDI$PVOUFWFOUUPVDIFTMFOHUI ΫϥΠΞϯτ࠲ඪ DMJFOU9FWFOUUPVDIFT<>DMJFOU9 DMJFOU:FWFOUUPVDIFT<>DMJFOU: ʜͦͷଞ͍Ζ͍ΖΠϕϯτरͬͯʜ

    λονͨ͠ҐஔʹԁΛදࣔ͢Δ DJSDMFDTT \ PQBDJUZ  UPQDMJFOU: QY  MFGUDMJFOU9 QY  USBOTGPSNTDBMF  GPSDF   ^  ^
  8. ࢦΛ཭ͨ͠Βফ͢ʢಁ໌ʹ͢Δʣ GVODUJPOUPVDIFOE)BOEMFS FWFOU \ DJSDMFDTT \ PQBDJUZ ^  ^

  9. 5PVDIFWFOUTͷ஋ DMJFOU9DMJFOU: ϒϥ΢βΫϥΠΞϯτྖҬ಺ͷ࠲ඪ GPSDF ײѹ JEFOUJpFS ಉ࣌λον਺ͷࣝผࢠ QBHF9QBHF: ϖʔδྖҬ಺ͷ࠲ඪ SBEJVT9SBEJVT:

    λον͍ͯ͠Δ໘ੵͷ൒ܘ SPUBUJPO"OHMF λονͷೖࣹ֯ʁɹ˞ඇ҆ఆϓϩύςΟ TDSFFO9TDSFFO: εΫϦʔϯྖҬ಺ͷ࠲ඪ UBSHFU λον͍ͯ͠Δ%0.
  10. ࢖͍ಓ w DBOWBTͱ࿈ܞͨ͠खඳ͖දݱ w ը૾ͷτϦϛϯάૢ࡞ͤ͞ΔͳͲ w ղੳɺτϨʔεʢѱ͞ʹ࢖͑ͦ͏ʜʣ ඇωΠςΟϒͳ8FCΞϓϦͷՄೳੑ͕૿͢ɻ

  11. (14 (FPMPDBUJPO"1*

  12. IUUQTHPPHM[8P.E4

  13. (14ͷर͍ํ͸छྨ Ґஔ৘ใΛҰճ͚ͩऔಘ͢Δ OBWJHBUPSHFPMPDBUJPOHFU$VSSFOU1PTJUJPO  Ґஔ৘ใΛఆظతʹ؂ࢹ͢Δ OBWJHBUPSHFPMPDBUJPOXBUDI1PTJUJPO  جຊతʹXBUDI1PTJUJPO ͚ͩ࢖͑͹Α͍ʢͬΆ͍ʣ

  14. OBWJHBUPSHFPMPDBUJPOXBUDI1PTJUJPO GVODUJPO QPTJUJPO \ औಘͨ͠Ң౓ܦ౓Λ(PPHMF.BQ"1*ʹ౤͛Δ MBU-OHOFXHPPHMFNBQT-BU-OH  QPTJUJPODPPS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ۄస͕͠ܥɻθϧμ#PU8ʹ͋ͬͨΞϨʣ w 73ػثͷίϯτϩʔϥʔ w *P5ػثʹϞʔγϣϯηϯαʔͱͯ͠OPEFKTͰݺͼ ग़͢ͳͲ *P5༻్ʹՄೳੑ͸͋Δ͕ɺ8FCతʹ࣮༻ੑ͋Δ࢖͍ ಓ͸ബͦ͏ɻ

  23. Ճ଎౓ηϯαʔ %FWJDF.PUJPOFWFOUT

  24. IUUQTHPPHM5BB&-K

  25. EFWJDFNPUJPOΛर͏  GVODUJPO \ XJOEPXBEE&WFOU-JTUFOFS EFWJDFNPUJPO EFWJDFNPUJPO)BOEMFS  ^ 

  26.  GVODUJPOEFWJDFNPUJPO)BOEMFS FWFOU \ WBSYFWFOUBDDFMFSBUJPOY9࣠Ճ଎౓ WBSZFWFOUBDDFMFSBUJPOZ:࣠Ճ଎౓ WBS[FWFOUBDDFMFSBUJPO[;࣠Ճ଎౓ WBSMJNJUՃ଎Λ൑ఆ͢ΔϦϛοτ஋ JG YMJNJU

    \9࣠ਖ਼ํ޲ʹϦϛοτΛӽ͑ͨΒʮӈʯ BSSPXDIJMESFO JNH DTT \USBOTGPSNSPUBUF EFH ^  ^ FMTFJG YMJNJU \9࣠ෛํ޲ʹϦϛοτΛӽ͑ͨΒʮࠨʯ BSSPXDIJMESFO JNH DTT \USBOTGPSNSPUBUF EFH ^  ^ FMTFJG ZMJNJU \:࣠ਖ਼ํ޲ʹϦϛοτΛӽ͑ͨΒʮ্ʯ BSSPXDIJMESFO JNH DTT \USBOTGPSNSPUBUF EFH ^  ^ FMTFJG ZMJNJU \:࣠ෛํ޲ʹϦϛοτΛӽ͑ͨΒʮԼʯ BSSPXDIJMESFO JNH DTT \USBOTGPSNSPUBUF EFH ^  ^ FMTFSFUVSO ^
  27. 9࣠ʹෛ :࣠ʹਖ਼ :࣠ʹෛ 9࣠ʹਖ਼

  28. %FWJDF.PUJPOFWFOUTͷ஋ BDDFMFSBUJPOY :࣠ʢॎ࣠ʣͷՃ଎౓ BDDFMFSBUJPOZ 9࣠ʢԣ࣠ʣͷՃ଎౓ BDDFMFSBUJPO; ;࣠ʢલޙ࣠ʣͷՃ଎౓

  29. ࢖͍ಓ w ʮৼΔʯ6*ɻ࡟আॲཧ΍ϖʔδͷલޙͳͲ w ήʔϜɻ௼ΓͷΩϟεςΟϯάͷڧ͞൑ఆͳͲ w *P5ػثͷ଎౓΍མԼηϯαʔ খࠁΈͰ΋αοͱಈ͔ͤ͹ݕ஌Ͱ͖ΔͷͰɺ
 ܏͖ΑΓ6*ͱͯ͠࢖͍΍͍͢ɻ

  30. র౓ηϯαʔ "NCJFOU-JHIU"1* ۙ઀ηϯαʔ 1SPYJNJUZ"1* ͜ͷ఺͸J1IPOFඇରԠͰ֬ೝͰ͖ͣɻ
 "OESPJEͷ'JSFGPYͷΈ֬ೝՄೳɻ

  31. +BWB4DSJQUϕʔεͷ
 ΞϓϦ։ൃͷબ୒ࢶʹθώɻ

  32. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ