dimanche 3 janvier 2021

How to achieve a smooth drag effect in iOS?

How to achieve a smooth drag effect in iOS?

I am developing a drag effect in a mobile project.

I found that when I started dragging an element in iOS, it did not move smoothly, there would be some jitters, the slower the dragging speed of the finger, the more obvious it would be. But there is no such problem in my Android device.

I wrote a demo, and found that there may be two reasons:

  1. As the drag speed becomes slower, the interval between touchmove events will be longer;
  2. The clientX/clientY of the touch point in TouchEvent are integers.

I want to ask, is there any way to make the drag effect smooth in iOS?

Below is my demo page:

https://cdpn.io/BiosSun/debug/VwKXQdd/VGrWNGQRBnYM (Open it in a mobile browser)

and the screen recording of the demo:

iOS

enter image description here

Android

enter image description here




Aucun commentaire:

Enregistrer un commentaire