Skip to main content
MHamm.6
Visitor II
May 24, 2022
Question

Is it possible to let the TextureMapper (TouchGFX) spin infinitly?

  • May 24, 2022
  • 1 reply
  • 718 views

I'm spinning a Texture Mapper Animation around the Z Angle. I want it to spin infinitly, but since it can only spin to a given Angle, I have to reset the Z Angle to 1, once the Animation is finished and start it again. This causes a visible jump in the Animation. I could let the Z Angle count up to Infinity, but I'm worried that this will cause problems.

This topic has been closed for replies.

1 reply

Yoann KLEIN
ST Employee
May 27, 2022

Hello @MHamm.6​ ,

Yes, it is possible.

Like you said, you can let the function run with Z angle getting increased to a huge number, that will cause no issues.

If you want to run the Animation infinitely, you can also interface that angle increase with a Timer, e.g. by calling the handleTickEvent() method in MainView.cpp. You will have to synchronize the angle updates animation with the Timer event function calls, to make it run smoothly on the display.

For example, a way to implement it could be that :

void MainView::handleTickEvent()
{
 counter++;
 
 if (counter % 60 == 0)
 {
 angle += 2;
 textureMapperImage.setupAnimation(AnimationTextureMapper::Z_ROTATION, textureMapperImage.getZAngle() + angle, 130, 0, EasingEquations::cubicEaseInOut);
 textureMapperImage.startAnimation();
 counter = 0;
 }
}

Let me know if you have other questions,

/Yoann

Yoann KLEINST Software Developer | TouchGFX