Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Animation of a Button just added to a layout

    Hello Isomorphic,

    I have the requirement to add a button to a layout and animate immediately after its adding. But the animation does not work. I have created a testcase:
    Code:
    function animateButton() {
    
        animatedButton.animateFade(0, function () {
            animatedButton.animateFade(100, function () {
                animatedButton.animateFade(0, function () {
                    animatedButton.animateFade(100)
                }, 600)
            }, 600)
        });
    }
    
    isc.HLayout.create({
        ID: "naviagtionLayout",
        width: "100%",
        height: "100%",
        members: [
        isc.VLayout.create({
            width: "50%",
            height: "100%",
            showResizeBar: true,
            members: [
            isc.Button.create({
                title: "Add animated button",
    	    width: 200,
                click: function () {
                    naviagtionLayout.addMember(
                    isc.Button.create({
                        ID: "animatedButton",
    					width: 200,
                        title: "this button should be animated directly after adding"
                    }));
                    animateButton();
    
                }
    
            }),
    
            isc.Button.create({
                title: "animate created button",
    	    width: 200,
                click: function () {
                    animateButton();
    
                }
    
            })
    
            ]
        })]
    });
    After pressing the button "Add animated button" the button "this button should be animated directly after adding" is added to the layout, but without the animation. The animation code itself works well on the button after it was created. To check this, I have added the second button "animate created button".

    How can I add a button to a layout and animate it?

    Regards Thomas

    P.S. Same behavior in 7.0 RC2 and 8 beta

    #2
    When you add a button to a Layout, it doesn't necessary draw() synchronously, but you can call reflowNow() to cause it be drawn immediately. Then it will accept animation.

    Comment


      #3
      Thank you for the quick response. Yes reflowNow did the trick. :-)

      Comment

      Working...
      X