Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-5379

Android: 0.5 Opacity property flickers at end of an animation

    Details

      Description

      This is an extension of http://jira.appcelerator.org/browse/TIMOB-2851

      // Android 2.2 HTC Evo / Ti 1.6.0
      // Red box displays at 1.0 opacity. Toggle button will successfully fade.
      // After fade, toggle button will not work until the second press. Fade back in.
      // Next press will fade out to 0.0. Rinse, repeat. :-)
       
      var win = Ti.UI.createWindow({ backgroundColor:'#000' });
      var view = Ti.UI.createView({ backgroundColor:'#f00', opacity:1.0, width:100, height:100 });
      var toggleBtn = Ti.UI.createButton({ width:200, height:30, bottom:10, title:'toggle opacity' });
       
      function toggleOpacity(e) {
          var counter = 0;
          
          view.animate({ opacity:(view.opacity === 0.5) ? 1.0 : 0.5, duration:1000 }, function(e) {
              if (counter === 0) {
                  Ti.API.info('This is only called once due to the counter.');
                  
                  view.opacity = (view.opacity === 0.5) ? 1.0 : 0.5;
                  
                  Ti.API.info(view.opacity);
                  
                  counter ++;
              }
          });
      }
       
      toggleBtn.addEventListener('click', toggleOpacity);
       
      win.add(view);
      win.add(toggleBtn);
      win.open();
      

      Run the code snippet listed above, and click on the 'toggle opacity' button. When it fades out, there is a flicker at the end of the animation. Note that this works if you changes the values in app.js from 0.5 to 0.0. This is only an issue for opacity values between 0 and 1.

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              ayeung Allen Yeung
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-4561
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration