Expanding a View with Animation

You must Login before you can answer or comment on any questions.

Hi,

I am trying to make a view animate while it is appearing. The content only appears once a button is clicked. The content is displayed but there is not animation happening and the the content being displayed appears in an abrupt way. Here is the code I am using.

var scrollView = Titanium.UI.createScrollView({
        contentHeight:'auto',
        top:80,
        showVerticalScrollIndicator:true,
    });
 
    var view = Ti.UI.createView({
        layout:'vertical',
        height:Ti.UI.SIZE,
        top:0,
        //borderWidth: 1,
        //borderColor: "#ff0000"
    });
 
    var details_wrap = Titanium.UI.createView ({
        width:290,
        height:Ti.UI.SIZE,
        top:10,
        right: 15,
        left: 15,
        bottom:10,
        layout:'vertical',
        //borderWidth: 1,
        //borderColor: "#ffEE00" 
    });
    view.add(details_wrap);
 
    var full_details_but = Titanium.UI.createButton({
        backgroundImage:'images/list/view-all.png',
        left:10,
        height:30,
        width:120,
        borderWidth: 1,
        borderColor: "#999" 
    });
    cp_buts.add(full_details_but);
 
    var hide_details_but = Titanium.UI.createButton({
        backgroundImage:'images/list/hide-all.png',
        left:10,
        height:30,
        width:120,
        borderWidth: 1,
        borderColor: "#999" 
    }); 
 
    var full_details = Titanium.UI.createView({
    top:0,
    height:Ti.UI.SIZE,
    layout:'vertical'
    });     
 
    full_details_but.addEventListener('click', function() {             
        cp_buts.add(hide_details_but);
        details_wrap.add(full_details);
        full_details.animate({top:100,duration:500});           
    });
 
    hide_details_but.addEventListener('click', function() {
        cp_buts.remove(hide_details_but);   
        cp_buts.add(full_details_but);
        details_wrap.remove(full_details);
        full_details.animate({top:0,duration:500});     
    });
I'm on OSX Mountain Lion, testing on iOS, Titanium V 2.1.3.v20120915120319.a77d91c.

Your Answer

Think you can help? Login to answer this question!