Touch Forward. Bill Fisher. #touchfwd. Developing Awesome Cross-Browser Touch

Similar documents
Hell is other browsers - Sartre. The touch events. Peter-Paul Koch (ppk) WebExpo, 24 September 2010

Write a Touch-friendly HTML5 App. Hongbo Min, Intel Junmin Zhu, Intel Yongsheng Zhu, Intel

CS193X: Web Programming Fundamentals

Developing for touch. Peter-Paul Koch Mobilism, 16 and 17 May 2013

5/19/2015. Objectives. JavaScript, Sixth Edition. Using Touch Events and Pointer Events. Creating a Drag-and Drop Application with Mouse Events

Web App Vs Web Site. Some tricks of the trade. Laurent Technical Director, BlackBerry Web Platform

Fast Mobile UIs. You re an Edge Case. Thursday, 8 March, 12

Creating Content with iad JS

Definitions. Interfaces. Example. Create a canvas. Setting up the event handlers. Tracking new touches

Hell is other browsers - Sartre. The touch events. Peter-Paul Koch (ppk) DIBI, 28 April 2010

Catching Events. Bok, Jong Soon

Introduction to Touch events in JavaScript

Index. Bootstrap framework ASP.NET MVC project set-up, default template, 223

SEEM4570 System Design and Implementation. Lecture 3 Cordova and jquery

mgwt Cross platform development with Java

SEEM4570 System Design and Implementation. Lecture 3 Events

CSS: Responsive Design, CSS3 and Fallbacks

Firefox 4 for Mobile Reviewer s Guide. Contact us:

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

EnGiNeErInG HtMl5 applications for better performance

City of Mobile GIS Web Mapping Applications: New Technology, New Expectations

Lab 1: Introducing HTML5 and CSS3

Improving the Accessibility and Usability of Complex Web Applications

Scripting. Web Architecture and Information Management [./] Spring 2009 INFO (CCN 42509) Contents

Table of contents. Sliding Panels DMXzone.com

HTML5 HTML & Fut ure o Web M edi dia Streami a est Work h op, ov 2010 Michael Dale Zohar Babin eve oper o Dev R l e t a i tions & C

Visual HTML5. Human Information Interaction for Knowledge Extraction, Interaction, Utilization, Decision making HI-I-KEIUD

WebKit ; FOR : DUMMIES. by Chris Minnick WILEY. John Wiley & Sons, Inc.

Pro ios Design and. Development. HTML5, CSS3, and JavaScript with Safari. Andrea Picchi. Apress*

Mobile & More: Preparing for the Latest Design Trends

More CSS goodness with CSS3. Webpage Design

HTML5 and CSS3: New Markup & Styles for the Emerging Web. Jason Clark Head of Digital Access & Web Services Montana State University Library

Step 5 How to download free Music from YouTube You need a YouTube account to download free Music from YouTube. If you don t have a YouTube account,

Mobile 3.1 ios & Android v2

Index. Border-radius property, Border-radius revolution, 112

HTML5 for mobile development.

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

Designing with CSS3 Effectively & Efficiently. October 2010 Adobe MAX Zoe Mickley

Course 20480: Programming in HTML5 with JavaScript and CSS3

A pixel is not a pixel. Peter-Paul Koch BlackBerry Jam, 6 February 2012

Prospective Units. 0 - The History of HTML5: Making it Interactive. 1 - Animating with JS & CSS: Making it Move

COURSE 20480B: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

WHAT IS WEBKIT? COPYRIGHTED MATERIAL SMASHING WEBKIT CHAPTER 1

The Economist Apps. Advertising specs

Friday, January 18, 13. : Now & in the Future

The Scope of This Book... xxii A Quick Note About Browsers and Platforms... xxii The Appendices and Further Resources...xxiii

Building mobile app using Cordova and AngularJS, common practices. Goran Kopevski

Khronos and the Mobile Ecosystem

Paid user:1,600,000 $3 /month

Programming in HTML5 with JavaScript and CSS3

Viewports. Peter-Paul Koch DevReach, 13 November 2017

Styling Web Applications Presented by Roel Fermont

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

B r o w s e r s u p p o r t

QCon - Mobile Maps HTML5 Team Andrea

Titanium.UI.View Class API

Table of contents. HTML5 Image Enhancer Manual DMXzone.com

Table of contents. Sliding Menu Manual DMXzone.com

Index LICENSED PRODUCT NOT FOR RESALE

Mobile Applications 2013/2014

Advanced Development with the ArcGIS API for JavaScript. Jeremy Bartley, Kelly Hutchins, Derek Swingley

Contents FORMAT 3. Specifications STATIC ADVERTISING 4. Interstitial HTML5 ADVERTISING 5-12

Master Project Software Engineering: Team-based Development WS 2010/11

Qiufeng Zhu Advanced User Interface Spring 2017

Leveraging the HTML5 Canvas/Javascript for web and mobile maps with CartoVista

Photo from DOM

Frontend guide. Everything you need to know about HTML, CSS, JavaScript and DOM. Dejan V Čančarević

Unifying the Flash and HTML5 Video Experience

HCDE 530: Computational Techniques for HCDE Data Visualization in Web, Part 2

729G26 Interaction Programming. Lecture 4

Lifespan Guide for installing and using Citrix Receiver on your Mobile Device

CSS3: Using media queries to improve the web site experience. November 19, 2011 indieconf Zoe Mickley

JavaScript: Events, the DOM Tree, jquery and Timing

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 4 Test Bank

Firefox for Android. Reviewer s Guide. Contact us:

Step 4 Part F - How to Download a Video on YouTube and Delete a Video

Javascript Performance in the Browser. Charlie Fiskeaux II User Interface Engineer

Content Visualization Issues

Internet & Web

Responsive Design and Mobile Patterns

Fundamentals of Website Development

Living through Flash to ipad/html5 Conversion and Development

Client-side Debugging. Gary Bettencourt

of numbers, converting into strings, of objects creating, sorting, scrolling images using, sorting, elements of object

Building Page Layouts

CSE 154 LECTURE 10: MORE EVENTS

Introduction to HTML 5. Brad Neuberg Developer Programs, Google

The plural of Chromium is Chromia. Peter-Paul Koch Mobilism, 27 March 2015

Tablet - is the generic term for a mobile computer with touchscreen display that is operated with fingers or stylus pen instead of a mouse and

The Next Step. DPS Adobe Digital Publishing Suite. Apple cofounder Steve Jobs stated in a 1983 speech

Review of Mobile Web Application Frameworks

Graphical Interaction

State of the Open Web. Brad Neuberg, Google

Firefox for Nokia N900 Reviewer s Guide

NEW WEBMASTER HTML & CSS FOR BEGINNERS COURSE SYNOPSIS

Etanova Enterprise Solutions

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code.

Android Pre-Release Deployment Release Notes (R2)

WebSphere Puts Business In Motion. Put People In Motion With Mobile Apps

Web browser architecture

Transcription:

Touch Forward Developing Awesome Cross-Browser Touch Interactions Bill Fisher @fisherwebdev #touchfwd

Super F*cking Important yeah, it s important.

http://commons.wikimedia.org/wiki/file:071228_human_hands.jpg

http://commons.wikimedia.org/wiki/file:touchscreen_img_2796.jpg

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

standard order of events in a tap touchstart touchmove (+n) touchend mouseover mousemove (usually once) mousedown mouseup click mouseout

delays after touch events Mobile Safari: ~380ms Android Browser: ~300ms Chrome on Android: ~240ms Opera Mobile on Android: ~260ms FF on Android: ~310ms

it s not okay. audio: 10ms distracting, 20ms echo video: 33ms frame rate, 17ms screen refresh HCI research: 100ms < not instantaneous

response times 100ms: the threshold of the feeling that the app is responding instantaneously 100ms - 1000ms: user loses the feeling of operating directly on the data 1000ms: user s flow of thought is interrupted http://www.useit.com/papers/responsetime.html

viewport meta tag <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> eliminates delay in some browsers: Chrome for Android Firefox for Android it would be great if this effect was more widespread!

a pretty clear choice Play it safe with click and create a laggy experience Do some work with detecting touch event support and create something that responds nicely

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

touch event support Mobile Safari Android Browser Opera Mobile Chrome for Android also supports v.2 Chrome for ios Firefox for Android also supports v.2 Blackberry Browser NOT: Opera Mini or Internet Explorer

w3c touch events v.1: the events touchstart touchmove touchend touchcancel

w3c touch events v.1: event properties inherits from UIEvent (...so shiftkey, etc.) touches (Array) targettouches (Array) changedtouches (Array)

w3c touch events v.1: touch properties pagex / pagey clientx / clienty screenx / screeny target identifier

w3c touch events v.1: methods preventdefault this is your friend stoppropagation & other UIEvent methods inittouchevent

w3c touch events v.2: new events & properties new events: touchenter / touchleave new property: relatedtarget

w3c touch events v.2: new touch properties radius X / radiusy rotationangle force (vendor prefixed in Firefox and Chrome)

ok, now what? We can get the data from the events. But what do we do with it?

setting up the page: html and javascript <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> /* if we want to lock down the scrolling entirely */ window.addeventlistener("touchmove", function(e){ e.preventdefault(); });

setting up the page: css html { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0,0,0,0); }

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

Hey U get on the GPU hardware accleration multicore programming much improved performance

CSS3 hacks for hardware acceleration any transition any 3D transform translate3d(0,0,0) or translatez(0)

testing for hardware acceleration Chrome about:flags: Composited render layer borders & FPS counter Start Safari in Terminal: CA_COLOR_OPAQUE=1 / Applications/Safari.app/Contents/MacOS/Safari Start iphone Simulator in Terminal: CA_COLOR_OPAQUE=1 /Developer/Platforms/ iphonesimulator.platform/developer/ Applications/iPhone\ Simulator.app/Contents/ MacOS/iPhone\ Simulator

event handlers throttled frame rates: with a maximum rate or ideally with requestanimationframe temporarily name anonymous functions so they may be profiled separate reading and modifying of DOM values

things to avoid DOM manipulation: hit the DOM once accidental browser layout reflow animated css shadows and gradients

gesture events only available in Mobile Safari two fingers rotation, scale convenient for prototyping, but not worth it for production

...but we want gestures difficult to determine user intention in a touch environment lots of logic and a bit of math to maintain libraries can help

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

Plugins and Libraries Touchy Hammer.js jgestures Zepto https://github.com/bebraw/jswiki/wiki/touch

Touchy a highly configurable jquery plugin for managing touch events sponsored by Hot Studio vanilla JS version, mouse fallback, and IE10 support coming soon

Touchy loosely based on native ios gesture recognizers: drag, swipe, pinch, rotate, longpress event handlers receive the phase of the event in a parameter, in addition to other data touchyjs.org check it out! @touchyjs

Hammer.js http://eightmedia.github.com/hammer.js/ Very similar to Touchy Mouse support, including IE8 & IE9 Covers a few more events (tap, double tap) Less flexible for custom interactions jquery plugin or vanilla JS

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

W3C Pointer Events w3c proposal from Microsoft abstracts mouse, touch and stylus into unified event model inherits from UIEvent independent events for each touch implemented in IE10 for Windows 8

stylin with a stylus Pointer Events improve stylus interactions: pressure tiltx / tilty allows expressiveness previously not attainable

gaming consoles Pointer Events could improve browsing with a game controller support for up to five buttons on each pointer two users with two controllers could be interacting with the page independently

Pointer Events: no gestures? How do we create gestures that require the association of multiple pointers? Can two people both do multitouch?

MSPointerEvent & MSGestureEvent in IE10 standard gestures: long press,... a lot of boilerplate for custom gestures minimum of two fingers event data values are matrix values inertia is available by default!

MSGestureEvent boilerplate: css body { /* prevent default gestures */ - ms- touch- action: none; } /* prevent text selection */ - ms- user- select: none;

MSGestureEvent boilerplate: javascript var customgesture = new MSGesture(); var elem = document.getelementbyid("thang"); // assign the element to the gesture object customgesture.target = elem; elem.addeventlistener("mspointerdown", function (ev) { // each pointer must be added to the gesture customgesture.addpointer(ev.pointerid); });

MSGestureEvent event handler elem.addeventlistener("msgesturechange", function (ev) { // get the current css transform matrix var matrix = new MSCSSMatrix(ev.target.style.transform); // apply a new matrix built from the old ev.target.style.transform = matrix.rotate(ev.rotation * 180 / Math.PI).scale(ev.scale).translate(ev.translationX, ev.translationy); });

pointer.js MSPointerEvents polyfill does not change the target of the event on touchmove / mousemove by Boris Smus (Google)

PointerEvents.js MSPointerEvents polyfill, but it does attempt to fire events on new elements during touchmove / mousemove. by Daniel Freedman (Google)

The Agenda click vs. mouseend vs. touchend touch events overview and how-to animations with hardware accelerated CSS and/ or requestanimationframe plugins & libraries for the lazy & the sane pointer events and our beloved Internet Explorer haptic feedback the post-touch world to come

getting hip to haptics var elem = document.queryselector(".vibe"); elem.addeventlistener("touchstart", function () { elem.style.background = "#f00"; if (navigator.vibrate) navigator.vibrate(12); }); elem.addeventlistener("touchend", function () { elem.style.background = "transparent"; });

post-touch touch is limited by the pictures under glass problem feelscreens could help motion-capture could rival touch, but will not supplant it without haptics pointer events might work in the near term with Kinect-like devices

FTW click is not good enough. there s all kinds of awesome in touch events and hardware accelerated css! IE10 is kind of cool, but pointer events are way cool. fight for the web by making it awesome!

Thanks! @fisherwebdev