Haptic Feedback


(Jonathan Bowman) #1

Hello all, how would I use haptic feedback in a file that is triggered by a button?

http://diagramcenter.org/adding-haptic-feedback-to-html.html


#2

Hi Jonathan!

I’ve not used the haptic feature - but no one else has answered. So if there is a general set-up question maybe I can help. What in particular is not clear to You - where the code should go… how to trigger it?


(Jonathan Bowman) #3

Jim,

Thanks for answering! Regarding how this is triggered, I’d creat a button that has an “on click,” state; clicking would trigger the phone to shake.

Thanks


#4

Getting back to your original question of “how would I use?”

What is giving You issues?


(Jonathan Bowman) #5

I need to add it to an interaction to tell a user something has changed on the screen.


(Jonathan Deutsch) #6

Note this is not supported on iPhones. In theory you add a Run Javascript… action with code like:

// enable vibration support
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;

if (navigator.vibrate) {
	// vibration API supported
	navigator.vibrate([500]);
}

There’s more examples here:
https://googlechrome.github.io/samples/vibration/

And this site had the browser check code: