+ var x = evt.changedTouches[0].screenX;
+ var delta = x - this.touchStartX;
+ if (delta) {
+ disableDefault(evt);
+ var now = (new Date()).getTime();
+ if (now - this.lastMoveTime < 100) {
+ // au delà de 100 ms de maintient, on annule l'inertie
+ var speed = delta / (now - this.touchStartTime);
+ var x0 = parseInt(this.film.style.left, 10);
+ var t0 = (new Date()).getTime();
+ var d = 500; // milisecondes
+ delta = 0;
+ var dt = 25;
+ var self = this;
+
+ var animate = function() {
+ // inertie
+ var t = (new Date()).getTime() - t0;
+ if (t < d) {
+ setTimeout(animate, dt);
+ delta = delta + (1-t/d) * speed * dt; // décelleration linéaire
+ self.setFilmPosition(x0 + delta);
+ }
+ };
+ animate();
+ }
+ }