drag animation lag
im trying to move an image around the screen.
ive put together a quick test using the basic animation example from kitchen sync.
when i drag the circle there is a lot of lag as though there is elastic between my finger and the circle.
is the any other way to drag and move rather than using the animation functions?
or a way to minimize the lag?
1 Answer
-
Accepted Answer
Hi Steve,
There is. Change for instance this code:
imageview.addEventListener('touchmove',function(e){
imageview.animate({center:{x:e.x,y:e.y}, duration:0});
});into this:
var counter = 0;
imageview.addEventListener('touchmove',function(e){
if ((counter % 5) == 0) {
imageview..animate({center:{x:e.x,y:e.y}, duration:0});
}
counter += 1;
});This way the animation gets executed only one out of 5 touchmove events registered by the machine.
Good luck!