Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Animation flicker

$
0
0

Hi, I test my animation on my device and the animation flickers!!

// the window   ==================================
var starter = Ti.UI.createWindow({
    navBarHidden:true,
    top:0, 
    backgroundColor:'#000',
});
 
// frames   ======================================
var frame = [];
for(var i=0; i<68; i++){
    if( i < 10 )    frame.push('/Animations/pic-0'+ i +'.png');
    else        frame.push('/Animations/pic-'+ i +'.png');
}
 
// The view ==================================
  var motion = Ti.UI.createImageView({
    image: frame[0],
    top:0,
  });
 
starter.add(motion);
 
// start event  ==================================
starter.addEventListener('open', initStart);
 
function initStart(){ startMotion(0); }
 
// animation function
function startMotion( _index ){
    var index = _index || 0;
    if( index < frame.length ){
        motion.image = frame[index];
        setTimeout(function(){ startMotion( ++index ); }, 100);
    }   
    else alert("Done!");
}
 
starter.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>