I am currently working on building a viewer to display panoramic photos. I have the images placed on the inside of a CSS cube, and am working on how to control it utilizing the deviceorientation event in javascript.
I have found and implemented an algorithm to convert the raw data from the deviceorientation event into euler angles, but I am unsure of how to hook this data up to rotate the cube using the CSS 3d rotation transforms.
My goal is to be able to allow a user to hold their phone up and look around the panorama, similar to some commercial softwares out there.
I was thinking about utilizing three.js to do this, but the size of the library to too large for this particular project. We want to keep the overhead low.
Here is a pen of the code I currently have:
[REDACTED]
Any help would be greatly appreciated! Thanks!
UPDATE
I have some basic functionality working now. Here is the updated code:
[REDACTED]
You need to have screen rotation turned off, and you have to tilt your phone into a landscape view. My new problem now is how to make this whole thing work while the phone is held in an portrait position, as well as when screen rotation is turned on.