Titanium Community Questions & Answer Archive

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

ImageView repeatCount bug?

I have an animation that works except when the repeatCount is set to any value above 1 - which makes the animation loop indefinitely.

var imageView = Titanium.UI.createImageView({
    images:images,
    duration:100, // in milliseconds, the time before next frame is shown
    repeatCount:2,  // 0 means animation repeats indefinitely, use > 1 to control repeat count
    top:0,
    width: 320,
    height: 480
});

I should note that setting the value to 1 does the job but I need it to loop more than once. Is this a known bug?

— asked March 21st 2010 by Phi Chong
  • animation
  • imageview
  • repeatcount
2 Comments
  • I seem to have the same problem. In addition, when I set repeatCount to 1, it will play the animation once (as desired). However, when I call .start() again at a later point (which I need to do for my project), strangely it starts to loop the animation indefinitely.

    I have to agree with Phi, it does "feel" like a bug.

    My system specs are iPhone SDK 4.0 & Titanium SDK 1.3.2.

    Any help/insight/workarounds appreciated, thanks!

    — commented July 25th 2010 by S. H.
  • I also meet the same problem. My workaround is declare 2 variables, one for max of animation and one for counting current animation. And then I implement them into 'change' event. If current animation is equal max of animation, I will call 'stop' function.

    — commented July 30th 2010 by Ovan Phelps

7 Answers

  • Which platform(s)?

    — answered March 24th 2010 by Don Thorp
    permalink
    0 Comments
  • iPhone SDK 3.1 using titanium developer 1.0 and the mobile SDK 1.0

    — answered March 24th 2010 by Phi Chong
    permalink
    0 Comments
  • iPhone SDK 3.1 using titanium developer 1.0 and the mobile SDK 1.0

    — answered March 24th 2010 by Phi Chong
    permalink
    0 Comments
  • I have this same problem. Did you resolve the issue? This is with the Titanium 1.2 and iphone 4.2.

    — answered February 10th 2011 by John Wells
    permalink
    0 Comments
  • I've documented this bug here: https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/3122-imageview-animation-ignores-repeatcount-upon-second-call-to-start

    — answered February 12th 2011 by John Wells
    permalink
    0 Comments
  • Titanium is open source. it was mixed python and Object-C
    This code is about TiAnimation.m

    if (repeat!=nil)
    {
    [UIView setAnimationRepeatCount:[repeat intValue]];
    }

    So. I think that repeat argument doesn't have a infinity value.
    insane!

    — answered September 8th 2011 by Sang-Taik Jung
    permalink
    0 Comments
  • The BUG still persists as of my test today on Ti 3.5.0 GA.

    One simple workaround is to stop the animation upon the end of image sequence, like this:

    $.animation.addEventListener('change', function(e){
        if (e.index === current_clip_length-1) {
            $.animation.stop();
        }
    });
    

    I need to use such animation function due to unreliable cross-platform video playback control. Would love to know if native Ti videoplayer could be controlled frame by frame precisely.

    — answered February 27th 2015 by Dave Lee
    permalink
    0 Comments
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.