Skip to main content
PZamb.2
Associate III
October 18, 2023
Solved

touchgfx fade-in fade-out single button

  • October 18, 2023
  • 1 reply
  • 1462 views

Hi

I would like fade-in and fade-out of widget text, using a single button ,is possible?

How I can do?

Thank

This topic has been closed for replies.
Best answer by PZamb.2

Hallo

Thank for your answer, i create fade botton on/off with option "Add C Code" and implemented a virtual function in screenView:

void screenView::function1()
{


if (ROI_Txt.getAlpha()>200) {
ROI_Txt.clearFadeAnimationEndedAction();
ROI_Txt.setFadeAnimationDelay(6);
ROI_Txt.startFadeAnimation(0, 120, touchgfx::EasingEquations::linearEaseIn);
}
else
{
ROI_Txt.clearFadeAnimationEndedAction();
ROI_Txt.setFadeAnimationDelay(6);
ROI_Txt.startFadeAnimation(255, 120, touchgfx::EasingEquations::linearEaseOut);
}
}

I'll Try your suggest.

Thank

 

1 reply

Osman SOYKURT
Technical Moderator
October 18, 2023

Hello @PZamb.2 ,

You can easily do it with a toggle button for example, but you can also do it with a regular button based on the pressed state (with the getPressedState() function) of it.
Do you want support to make the fade animation or is it the button part that you need help on?

Osman SOYKURTST Software Developer | TouchGFX
PZamb.2
PZamb.2AuthorBest answer
Associate III
October 18, 2023

Hallo

Thank for your answer, i create fade botton on/off with option "Add C Code" and implemented a virtual function in screenView:

void screenView::function1()
{


if (ROI_Txt.getAlpha()>200) {
ROI_Txt.clearFadeAnimationEndedAction();
ROI_Txt.setFadeAnimationDelay(6);
ROI_Txt.startFadeAnimation(0, 120, touchgfx::EasingEquations::linearEaseIn);
}
else
{
ROI_Txt.clearFadeAnimationEndedAction();
ROI_Txt.setFadeAnimationDelay(6);
ROI_Txt.startFadeAnimation(255, 120, touchgfx::EasingEquations::linearEaseOut);
}
}

I'll Try your suggest.

Thank