Thanks for the instruction.
I changed the topic type and I'll try to provide running code.
I used the examples as well as checking older posts. Rotating the whole screen worked for me. My main confusion came from trying to rotate the shape and not the rest of the screen. Didn’t get it to work correctly. Certainly a mistake on my side .. but I was not able to find it.
What works:
- PShape Robot;
- float theta = 0;
- void setup (){
- size(500, 500, P2D);
- frameRate(10);
- Robot = createShape(RECT, -9.5, -8, 19, 16);
- Robot.setFill(255);
- }
- void draw(){
- background(255);
- theta += 0.1;
- pushMatrix();
- translate(250,250);
- rotate(-theta);
- shape(Robot);
- popMatrix();
- }
What doesn’t work is rotating the shape. Doesn’t matter where I place the translate. (well, it matters but I don’t get the point on how I have to do it)
I imagine that I can rotate the object independent from the rest of the screen and then draw the rotated object. Maybe that’s not correct?
- PShape Robot;
- float theta = 0;
- void setup (){
- size(500, 500, P2D);
- frameRate(10);
- Robot = createShape(RECT, -9.5, -8, 19, 16);
- Robot.setFill(255);
- }
- void draw(){
- background(255);
- theta += 0.1;
- Robot.resetMatrix();
- Robot.translate(0,0);
- Robot.rotate(-theta);
- Robot.translate(250,250);
- shape(Robot);
- }
Thanks
Robert