0

I am trying to integrate animation in a module where, when the dismiss button is clicked, the entire pendingTasksBar view's height turn to 0dp but at a stretch of 300ms. This is what i have tried so far. Can someone please help me out here?

function hidePendingTasksBar(){
    log.trace("[tasks]  >>  [hidePendingTasksBar]");

    var animationObj = Ti.UI.createAnimation({
        height : "0dp",
        duration : 300
    });
    $.pendingTasksBar.animate(animationObj);
    //.pendingTasksBar.height = "0dp";
}

2 Answers 2

0

Height property must be a Number, and you are using a String. I think that's the problem. Try using 0 instead of "0dp".

http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Animation-property-height

0

Setting height to 0 as number should work. And if it doesn't work, then you can safely use matrix transformation to decrease height or to increase it to same height again as below:

var matrix = Ti.UI.create2DMatrix();
matrix = matrix.scale(1, 0);

// to decrease height
$.pendingTasksBar.animate({
    duration : 300,
    transform : matrix
});


// to reset height
$.pendingTasksBar.animate({
    duration : 300,
    transform : Ti.UI.create2DMatrix()   // use empty matrix & it will reset original matrix or UI.
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.