[AC-1808] Start and complete event for animation are not working
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Hold |
| Resolution Date | 2013-03-15T18:19:20.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | animation, event, ios, triage |
| Reporter | Elmar Maan |
| Assignee | Shak Hossain |
| Created | 2013-01-25T10:17:06.000+0000 |
| Updated | 2016-03-08T07:40:42.000+0000 |
Description
When you add the start and the complete event to an animation, both of these events are not fired!
Hi Elmar, Please provide more details: 1. A simple reproducible test case (app.js) 2. Your system details i.e Mac OS version, Titanium Studio version. Thanks.
Apologies for jumping in, I took the following snippet from an old project I was updating and found the same issue. Just trying to action a function (alert in the demo below) after an animation has completed. Snow Leopard, iOS6, SDK3.0.0
//Page intro copy to fade in var pageIntro = Ti.UI.createLabel({ text: "Some intro copy...", font: {fontSize: 15, fontFamily: "Verdana"}, color: '#000', width: 192, height: 70, top: 55, textAlign: 'center', opacity: 0 }), pageIntroAnimation = Titanium.UI.createAnimation({ curve:Ti.UI.ANIMATION_CURVE_EASE_IN, opacity:1, duration:800 }); win.add(pageIntro); //Page intro copy fades in ok pageIntro.animate(pageIntroAnimation); pageIntroAnimation.addEventListener('complete', function(){ //Not getting in here to action a function/alert alert("Animation complete"); });//completeUnable to reproduce using this code and 3.0.0.GA in the simulator:
Also tried Craig's code, with the addition of the var "win" to get it to work. Was unable to reproduce with 3.0.0.GA in simulator. Will try device. To all, please provide additional info, such as iOS version, Xcode version, Mac OS version, CLI version ("ti -v" in terminal) and studio version.var sampleSetWindow = Ti.UI.createWindow({ }); var submitSampleButton = Ti.UI.createButton({ title: "Click to animate", top: 20 }); submitSampleButton.addEventListener("click", function(e){ sampleSetWindow.animate(closeAnimation); }); var closeAnimation = Ti.UI.createAnimation({ duration: 800, right: Ti.Platform.displayCaps.getPlatformWidth(), left: -Ti.Platform.displayCaps.getPlatformWidth(), }); closeAnimation.addEventListener("start", function(e){ Ti.API.info("Animation start"); }); closeAnimation.addEventListener("complete", function(e){ Ti.API.info("Animation complete"); }); sampleSetWindow.add(submitSampleButton); sampleSetWindow.open();Both examples work on device built with SDK 3.0.0.GA. Will revisit if we can get more info.
The code sample on its own works for Craig, but not in his app, created possibly circa 2.1.3. His app works when 2.1.3 is selected. He upgraded to Xcode 4.6 and no change. He discovered this work around for his issue and will provide more detail when he has time.
pageIntro.animate({ curve:Ti.UI.ANIMATION_CURVE_EASE_IN, opacity:1, duration:800 }, function(evt) { //run function alert("Animation Complete!"); });Will reopen when we get more information.