Skip to main content
WScot.1
Associate III
Question

On Off button Animation.

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?

This topic has been closed for replies.

4 replies

MM..1
Super User

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

WScot.1
WScot.1Author
Associate III

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);

}

wired
Senior II

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

WScot.1
WScot.1Author
Associate III

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