2020-05-10 02:53 AM
Hi,
i want to add a transition animation when the animation is over,i know the Animated Image contain a callback name setDoneAction(), but i want to realize like H750 demo,when the button is clicked,the fan is still turn for a moment and then stop, i want to do that.what should i do in the code?
Thanks.
Solved! Go to Solution.
2020-05-11 02:27 AM
Well there is multiple ways to do it. I guess you could just set a timer in handleTickEvent that you start when you turn off the button. Just make sure the tickCounter is set at 0 when you turn off the fan (in case the user presses the button on and off over and over again). Tell me if this is what you had in mind.
void MainScreenView::handleTickEvent()
{
if( (fan_Button.getState() == false) && (fan.IsAnimatedImageRunning == true) )
{
tickCounter++;
if(tickCounter == 30)
{
fan.pauseAnimation();
tickCounter = 0;
}
}
}
2020-05-11 02:27 AM
Well there is multiple ways to do it. I guess you could just set a timer in handleTickEvent that you start when you turn off the button. Just make sure the tickCounter is set at 0 when you turn off the fan (in case the user presses the button on and off over and over again). Tell me if this is what you had in mind.
void MainScreenView::handleTickEvent()
{
if( (fan_Button.getState() == false) && (fan.IsAnimatedImageRunning == true) )
{
tickCounter++;
if(tickCounter == 30)
{
fan.pauseAnimation();
tickCounter = 0;
}
}
}
2020-05-11 07:33 AM
yeah,thank you for your skillful answer,i realize it and it looks cool.
2020-05-11 07:46 AM
yeah,thank you for your skillful answer,i realize it and it looks cool.
2020-05-11 11:49 PM
perfect :smiling_face_with_smiling_eyes: