0

I wrote a web app use touchevent to change a dom's position,on touchstart

 start_position = [event.pageX,event.pageY]

at sometime add touchmove event,every trigger,change Translate3D in requestAnimationFrame's function

 current_position = [event.pageX,event.pageY]
 dom.style.webkitTransform = 'translate3d('+Math.round(offset*(i-1)+self.current_pos[0]-self.start_pos[0])+'px,0,0)'

I think there something else that I don't know to resolve this problem to make animation smooth..

I search iScroll's source code,but can't understand.. https://github.com/cubiq/iscroll/blob/master/src/utils.js

igaves
  • 63
  • 1
  • 6

1 Answers1

0

Switch to iScroll5. It's much more mature, configurable, stable, simple and comes with much better performance.

For better performance there is an option to use requestAnimationFrame and this is really awesome.

options.useTransition

iScroll uses CSS transition to perform animations (momentum and bounce). By setting this to false, requestAnimationFrame is used instead. On modern browsers the difference is barely noticeable. On older devices transitions perform better. Default: true

look here

TorchMan
  • 274
  • 3
  • 12