Skip to main content
uilter
Senior
June 27, 2023
Solved

MoveAnimator - Best practice to move an object

  • June 27, 2023
  • 2 replies
  • 2963 views

Hi,

I'd like to discuss the best practice or approach to execute an infinite animation, like a GIF, to execute is while the screen is running.

I've done a simple Box object, as an example purpose of my subject, to help in this topic. It could be line, circle or etc. Note: My goal here is about the shapes objects only.

I'd like to know if its the best way to do it. My current touchgfx version is the 4.22.

Many thanks!

I attached my code.

 

This topic has been closed for replies.
Best answer by Flemming Gram CHRISTENSEN

Your code looks fine. Except maybe the invalidate() in the callback. This redraws the whole screen.
It is better to say seed.MoveTo(10,10). This only redraws the part where the box was and is.

Maybe do the animation back and forth, instead of jumping back.

2 replies

Flemming Gram CHRISTENSEN
ST Employee
June 29, 2023

Your code looks fine. Except maybe the invalidate() in the callback. This redraws the whole screen.
It is better to say seed.MoveTo(10,10). This only redraws the part where the box was and is.

Maybe do the animation back and forth, instead of jumping back.

uilter
uilterAuthor
Senior
June 29, 2023

Hi @Flemming Gram CHRISTENSEN thanks for you reply!

Okay, I'll remove the invalidate().

Just a last question about the difference about the method setXY and moveTo.
The setXY just set the coordinates, unlike the moveTo function which, in addition to configuring, already invalidates the redraw?

Thanks.

Flemming Gram CHRISTENSEN
ST Employee
June 30, 2023

Yes, that is true and the reason we have them.