Jump to content
Search Community

GSAP HTML5 Banner that use Smartphone Accelerometer

Guest Pusher
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi All,

 

Starting from 0 here.

 

My boss has asked if a GSAP HTML5 Banner that use Smartphone Accelerometer is possible.

 

The idea would be that i multilayered image with a foreground, mid-ground and background would 'move' with the tilt on a smartphone.

 

Can anyone point me in the right direction?

 

Thanks for any help,

 

Phil

Link to comment
Share on other sites

I've never done it personally, but it seems totally doable. It's unrelated to GSAP, though. A quick Google search resulted in:

http://stackoverflow.com/questions/4378435/how-to-access-accelerometer-gyroscope-data-from-javascript

 

With the right hooks in place, you should be able to create the effect you're after. Let us know how it goes. We'd love to see the final result (and hear about any tips and tricks you discover along the way)

  • Like 1
Link to comment
Share on other sites

Here are some other useful links that might help. It's just setting up the right events to detect and have your animation with GSAP do different stuff depending on the orientation and rotation.

 

Detecting Device Orientation:

https://developer.mozilla.org/en-US/docs/Web/API/Detecting_device_orientation

 

Google HTML5 Rocks - This End Up: Using Device Orientation:

http://www.html5rocks.com/en/tutorials/device/orientation/

 

Device Motion Demo (test on mobile):

http://www.html5rocks.com/en/tutorials/device/orientation/devicemotionsample.html

 

:)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...