Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11403] Android: Animation: bouncy animation from alloy is very slow and throwing errors

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-20T18:24:40.000+0000
Affected Version/sRelease 2.1.3, Release 3.0.0
Fix Version/sRelease 3.2.0
ComponentsAndroid
Labelscore, insight, qe-and100112
ReporterNatalie Huynh
AssigneeAllen Yeung
Created2012-10-12T00:20:56.000+0000
Updated2013-10-23T20:36:45.000+0000

Description

Steps to Reproduce: 1. Make a new Alloy project 2. Use the Alloy bouncy logo widget (https://github.com/appcelerator/alloy/tree/master/test/apps/widgets/widget_bouncylogo) 3. Run it on Android. Actual: Crashes sometime, other time it is very slow and the logo disappears Expected: Should work smoothly

Attachments

FileDateSize
Bouncy.txt2012-10-12T00:20:56.000+00005231

Comments

  1. Tony Lukasavage 2012-10-12

    Here's a non-Alloy version of the original issue that you can drop in an app.js and exhibit the same behavior. iOS works fine, Android crashes repeatedly in emulator, appears to do nothing on my Galaxy Nexus. I have a strong suspicion it has to do with animating the {center} values as replacing those with {top} seems to animate the logo just fine. And as the bouncing logo doesn't bounce on the x-axis, using {top} seems a valid and perhaps even more efficient solution. Have at it.
       function chainAnimate(view, animations) {
           function step() {
               if (animations.length == 0) {
                   view = animations = null;
                   return;
               }
               var animation = animations.shift();
               animation.addEventListener('complete', step);
               view.animate(animation);
           }
           step();
       };
       
       var args = {
           opacity: 0.5,           // Fade into the background after it settles
           durationIn: 1000,        // Duration to slide onto the screen and become opaque
           durationBounce: 500,    // Duration to bounce before settling
           durationFade: 2000,     // Duration to fade to specified opacity
           bounciness: 0.25,        // 0 = no bounce, 1 = full height bounce
           width: 216,
           height: 200
       };
       var win = Ti.UI.createWindow({
       	backgroundColor: '#fff'
       });
       var image = Ti.UI.createImageView({
       	bottom: '100%',
       	opacity: 0,
       	image: '/alloy.png',
       	height: args.height,
       	width: args.width
       });
       win.add(image);
       
       win.addEventListener('open', function() {
       	var w = Ti.Platform.displayCaps.platformWidth; 
       	var h = Ti.Platform.displayCaps.platformHeight; 
       	var chain = [
       	    Ti.UI.createAnimation({ center: { x: w / 2, y: - h / 2 }, opacity: 0, duration: args.durationIn }),
       	    Ti.UI.createAnimation({ center: { x: w / 2, y: h / 2 + args.height * args.bounciness }, opacity: 1.0, duration: args.durationIn }),
       	    Ti.UI.createAnimation({ center: { x: w / 2, y: h / 2 - args.height * args.bounciness * 0.5 }, opacity: 1.0, duration: args.durationBounce }),
       	    Ti.UI.createAnimation({ center: { x: w / 2, y: h / 2 }, duration: args.durationBounce }),
       	    Ti.UI.createAnimation({ opacity: args.opacity, duration: args.durationFade })
       	];
       	chainAnimate(image, chain); 
       });
       win.open();
       
  2. Ingo Muschenetz 2012-10-13

    @Bill: I wanted to make sure it wasn't a regression, so it was great that we investigated it. I also marked anything merge-3.0.0 as High since I figured if it needs to go into 3.0.0 at this point, it's a high priority issue. I've since downgraded it and moved it into 3.1.0.
  3. Bill Dawson 2013-05-07

    This actually seems to work pretty good right now on master (3.2.0) -- perhaps 3.1.0 as well, I didn't try that. I ran it on my Galaxy Nexus and the emulator (2.33). No crashing, and the behavior appeared to be the same on device vs. emulator. Looks pretty much the same when I run it on iPhone simulator as well. To anyone else who tests: don't forget to get alloy.png and put it in Resources.
  4. Allen Yeung 2013-07-20

    Resolved as a part of https://github.com/appcelerator/titanium_mobile/pull/4398
  5. Lokesh Choudhary 2013-10-23

    Verified the fix. The bouncy animation is fast & smooth, not slow.Also we do not see any app crash on the emulator. Environment: Appcel Studio : 3.2.0.201310230601 Ti SDK : 3.2.0.v20131022171645 Mac OSX : 10.8.5 CLI - 3.2.0 with hash 72f7426b4ee6c2d2883c666d5b7e03906a16012f Android Emulator - 4.1.2

JSON Source