cancel
Showing results for 
Search instead for 
Did you mean: 

How rotation works in texture maps?

limit_SKY
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

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

View solution in original post

4 REPLIES 4
Alexandre RENOUX
Principal

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
Associate II

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

limit_SKY
Associate II

0693W00000Bbt5nQAB.png

Alexandre RENOUX
Principal

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