Hello,
i try to rotate 3 svg graphics individually but all I can get is the full-screen rotating on its center.
Here is the simplified code :
Code:
RotatingStar myStar1;
RotatingStar myStar2;
void setup()
{
myStar1 = new RotatingStar(color(255,0,0),0,100,2);
myStar2 = new RotatingStar(color(0,0,255),0,10,1);
}
void draw()
{
background(bgColor);
myStar1.move();
myStar1.display();
myStar2.move();
myStar2.display();
}
class RotatingStar {
color c;
float xpos;
float ypos;
float xspeed;
// The Constructor is defined with arguments.
RotatingStar(color tempC, float tempXpos, float tempYpos, float tempXspeed) {
c = tempC;
xpos = tempXpos;
ypos = tempYpos;
xspeed = tempXspeed;
}
void display() {
shape(wheel0, xpos,ypos, wheelWidth, wheelHeight);
}
void rotation() {
angle=angle+0.1;
rotate(angle); // here is the rotate()
}
}
Does anyone have a clue for this ?
Should I use matrix ou several PGraphics ?