Skip to main content
limit_SKY
Associate
June 22, 2021
Solved

How rotation works in texture maps?

  • June 22, 2021
  • 4 replies
  • 2421 views

Hello; 

I try to undestand touch gfx watch application. I could not understand how the pressure arrow is rotating without any interaction algorithm. Is the rotation of texture map related with orego? What makes the 2 step forward and 1 step backward, how can achieve this in a new created texture map?

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hello limit_SKY,

If you look at the code, you'll see that the pressure needle is an Animation Texture Mapper and every x seconds, we setup an animation for the needle. Here is the code related to the pressure needle :

pressureEntropi = (((seconds + minutes + hours) * (seconds + minutes + hours)) % 180) / 360.0f * 2 * PI - PI / 2;
pressure.setupAnimation(AnimationTextureMapper::Z_ROTATION, pressureEntropi, 250, 0, EasingEquations::cubicEaseInOut);
pressure.startAnimation();

And the prototype of setupAnimation() is as follows :

/**
 * Sets up the animation for a specific parameter (angle/scale) for the next animation.
 * The specific parameter is chosen using the AnimationType enum. AnimationTypes that
 * are not setup using this method will keep their value during the animation.
 *
 * @param parameter The parameter of the TextureMapper that should be animated.
 * @param endValue The end value for the parameter.
 * @param duration The duration for the animation of the parameter. Specified in
 * ticks.
 * @param delay The delay before the animation of the parameter starts.
 * Specified in ticks.
 * @param progressionEquation (Optional) the progression equation for the animation of this
 * parameter. Default is EasingEquations::linearEaseNone.
 */
 virtual void setupAnimation(AnimationParameter parameter, float endValue, uint16_t duration, uint16_t delay, EasingEquation progressionEquation = &EasingEquations::linearEaseNone);

You can find all this information yourself by going through the code and looking at AnimationTextureMapper.hpp/.cpp

/Alexandre

4 replies

Alexandre RENOUX
Visitor II
June 23, 2021

Hello limit_SKY,

What application exactly are you talking about ? (Maybe a picture could help)

If you want to know how the Texture Mapper works, I recommend you to look at the widget code available in any TouchGFX project.

You can also have a look at the API page on our documentation website.

/Alexandre

limit_SKY
limit_SKYAuthor
Associate
June 24, 2021

The project name is TouchGfx Watch. I use stm32h7 series. I wonder how the pressure line moves like this.

limit_SKY
limit_SKYAuthor
Associate
June 24, 2021

0693W00000Bbt5nQAB.png

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
June 25, 2021

Hello limit_SKY,

If you look at the code, you'll see that the pressure needle is an Animation Texture Mapper and every x seconds, we setup an animation for the needle. Here is the code related to the pressure needle :

pressureEntropi = (((seconds + minutes + hours) * (seconds + minutes + hours)) % 180) / 360.0f * 2 * PI - PI / 2;
pressure.setupAnimation(AnimationTextureMapper::Z_ROTATION, pressureEntropi, 250, 0, EasingEquations::cubicEaseInOut);
pressure.startAnimation();

And the prototype of setupAnimation() is as follows :

/**
 * Sets up the animation for a specific parameter (angle/scale) for the next animation.
 * The specific parameter is chosen using the AnimationType enum. AnimationTypes that
 * are not setup using this method will keep their value during the animation.
 *
 * @param parameter The parameter of the TextureMapper that should be animated.
 * @param endValue The end value for the parameter.
 * @param duration The duration for the animation of the parameter. Specified in
 * ticks.
 * @param delay The delay before the animation of the parameter starts.
 * Specified in ticks.
 * @param progressionEquation (Optional) the progression equation for the animation of this
 * parameter. Default is EasingEquations::linearEaseNone.
 */
 virtual void setupAnimation(AnimationParameter parameter, float endValue, uint16_t duration, uint16_t delay, EasingEquation progressionEquation = &EasingEquations::linearEaseNone);

You can find all this information yourself by going through the code and looking at AnimationTextureMapper.hpp/.cpp

/Alexandre