For an project using a TFT 3,5 Touchscreen with the Adafruit GFX and the MCUFriend library, I want to create endless rotating primitives (e.g., a rectangle). In the beginning, I thought it would be simple just creating a variable (int=r) that increases its value (r++;) which is then included in tft.setrotation(r); to rotate the rectangle.
Unfortunately it doesn't work. I hope anybody can help me, I assume the solution is not that complicated...
Try consulting actual documentation instead of taking wild guesses. The setRotation function only controls screen orientation.
The fact that the function doesn't require the geometric primitive to be identified should be a big red flag for you. What if there were two rectangles?...
Also, "it doesn't work" is not a useful problem report.
You can achieve rotation by using polar to rectangular conversion, Google it, and you can do that using the trig functions, sin() cos() etc. It's all high school math.
...and... when you signed up you were asked to read an introduction that asks you to post code for which you have questions, and tells you how to do that.
This article is one of many introductions into 2D graphics, and explains how to rotate and translate objects (like rectangles) on the screen. 2D computer graphics - Wikipedia