Another rotation question
in
Programming Questions
•
1 year ago
Hello everyone. I am just getting started with processing and have searched and read many topics on rotation around a center point. What I am trying to do is essentially spin a png (which is a picture of a cog) around its center point so that it looks like a stationary slowly spinning object. Eventually I want to be able to control the speed at which it spins. I thought I had set my center point correctly set but the program I have is drawing the png around a much larger centerpoint eventually forming a very large circle. Also every time it draws the previous rotation drawing remains - I only want to see the last draw. Any help is appreciated thank you in advance. See below code.
- PImage circle1;
- float angle = 0.0;
- void setup() {
- background(0);
- smooth();
- circle1 = loadImage("pixel.png");
- size(1800, 1800, JAVA2D);
- }
- void draw() {
- translate(circle1.width/2.0, circle1.height/2.0);
- // println("width is: " + circle1.width);
- //println("height is: " + circle1.height);
- rotate(radians(angle));
- //imageMode(CENTER);
- image( circle1,0,0);
- angle += 0.8;
- //delay(2);
- }
1