cancel
Showing results for 
Search instead for 
Did you mean: 

On Off button Animation.

WScot.1
Associate II

I have an on/off button animation which rotates 90 anti-clockwise on switch-off and rotates 90 clockwise on switch-on. The problem I have is that the Animation resets when I change screen and I don't always want this to happen?

4 REPLIES 4
MM..1
Chief III

Show your setup screen func, or place here setup state.

WScot.1
Associate II

One way to solve this is to have two animations, an 'on' to 'off' and an 'off' to 'on' animation. Simply control the alpha values to the correct animation when a screen change occurs. I don't know if there's another way to do this with just one animation that would be neater?

::setupScreen()

state = presenter->getState();

if(state)

{

animation1.setAlpha(ON);

animation2.setAlpha(OFF);

}

else

{

animation1.setAlpha(OFF);

animation2.setAlpha(ON);

}

animatedImage widget can be set to reverse the direction of animation. You just need to remember the last direction that was set.

WScot.1
Associate II

Thanks for your reply, I haven't tried that, but I will now. Thanks again. Will.