cancel
Showing results for 
Search instead for 
Did you mean: 

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

MHamm.6
Associate

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.

1 REPLY 1
Yoann KLEIN
ST Employee

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 KLEIN
ST Software Developer | TouchGFX