Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked April 15th 2010 by Steve Burtenshaw
  • animation
  • drag
  • iphone
  • lag

1 Answer

  • Accepted Answer

    Hi Steve,

    There is. Change for instance this code:

    imageview.animate({center:{x:e.x,y:e.y}, duration:0});

    into this:

    var counter = 0;
    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!

    — answered April 18th 2010 by Marijke Beekman
    1 Comment
    • Very good! :)

      — commented December 11th 2013 by Vittorio Sorbera
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.