Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19984] Android: transform animation doesn't work immediately after creating a view [android]

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-12-06T01:31:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
LabelsCommunity, TCSupportTriage, android, animation, qe-6.1.0, transform
Reportergrebulon
AssigneeGary Mathews
Created2014-12-30T11:37:15.000+0000
Updated2016-12-08T19:10:35.000+0000

Description

1. Create a view with an initial transform (it is important that an initial transform matrix is set) 2. Add the view 3. Call animate The animation will not work and the animation callback is not executed. Notes: 1. This problem is specific to *transform* animation. If the view is animated with left/right/top/bottom for example, everything works fine. 2. Deferring the animation, for example by putting it in a setTimeout callback, works if the timeout is long enough. *Sample code* - run this, click the button and view the result.
var window=Ti.UI.createWindow({backgroundColor:'white'});

mainView=Ti.UI.createView({backgroundColor:'white'});
window.add(mainView);

button=Ti.UI.createButton({left:0,right:0,height:40,bottom:0,title:'start'});
button.addEventListener('click',function(e) {
    Ti.API.info("********** start **********")
    var view=Ti.UI.createView({backgroundColor:'red',left:40,right:0,top:0,bottom:40,transform:Ti.UI.create2DMatrix().scale(0.1)});
    mainView.add(view);
    view.animate({left:0,transform:Ti.UI.create2DMatrix().scale(1),duration:500},function() {
        Ti.API.info("********** end **********")
        mainView.remove(view);
        view=null;
    });
});
mainView.add(button);

window.open();

Comments

  1. grebulon 2016-02-10

    This bug is very annoying? I don't understand how you keep delaying it again and again. It's been over a year!
  2. grebulon 2016-11-24

    High priority bug, reported 30/Dec/14 (Titanium 3.4.1)
  3. Gary Mathews 2016-11-30

    master: https://github.com/appcelerator/titanium_mobile/pull/8642
  4. Josh Longton 2016-12-08

    Verified as fixed adding an animation to run immediately after creation works as expected. Tested on: {noformat} macOS Sierra 10.12.1 Nexus 5X(6.0.1) Nexus 6p (7.0) android emulator (4.4.2, 6.0) Ti SDK: 6.1.0.v20161207121046 Appc NPM: 4.2.8 App CLI: 6.1.0-309 Node v4.4.7 {noformat} *Closing Ticket.*

JSON Source